Examples

Basic Examples

The following examples show record creation and search using CURL.

Authentication

Read the section on Authentication for worked examples on obtaining and using authentication credentials.

Connecting using Linux Bash

In curl:

curl -X GET "https://api.cw.crisisworks.com/api/json/ping" \
-H "Authorization: eyABCDEFG..." \
-H "X-Site: sandbox"

Connecting using Windows PowerShell

In Windows PowerShell:

Invoke-RestMethod `
  -Method Get `
  -Uri "https://api.cw.crisisworks.com/api/json/ping" `
  -Headers @{
    "Authorization" = "eyABCDEFG..."
    "X-Site"        = "sandbox"
  }

Record manipulation and searching examples

The following examples show record creation and search.

Record creation

The following example in Bash demonstrates how to create a register item record.

The following example in Bash demonstrates how to search items. This uses curl and jq.

Record updates

The following example shows how to update a record

Further Examples

The following examples provide quick integrations for popular requirements.

Importing asset contacts via the API

Example of importing asset contacts from a CSV file.

Note the data used in this example is embedded CSV within the JSON data. If you have a CSV file, look at the next example.

Uploading an import file

The following example shows how you may upload a CSV file to the import API, using BASH.

Here is the equivalent in Windows Powershell.

Adding images to Infrastructure Assessments

Attaching images to Register Items in Crisisworks happens in 2 steps.

  1. Upload the image

First, the image needs to be be uploaded to Crisisworks. On successful upload, a file id is returned. Example Request

Example Response:

The file id 289 from the response is used to update the register item.

  1. Update the item to attached the file The specific item then needs to be updated to include the file. In the case of an Infrastructure Item, we are adding to the "Damage Photos" - field name descriptionPhotos

Please note, when updating an item, all the required fields also need to be included in the payload, so you will need to get this data before making any updates.

In the instance of Infrastructure Assessment, the required fields are:

Field Name

Description

id

The item ID of the record being updated.

type

Should be set to "recoveryInfrastructure".

itemSchemaName

Set to "default".

infrastructureType

Set to the existing value for this field.

damageLevel

Set to the existing value for this field.

description

Set to the existing value for this field.

priority

Set to the existing value for this field.

eventId

Set to the existing value for this field.

Using Windows Command Prompt

Users may receive the following message when attempting to register an API Token when using Windows Command Prompt.

Windows command prompt has no support for single quotes like the Unix-like shells. As a result, you will need to replace the single quotes with double quotes AND escape them wherever necessary using back slashes.

Example

Last updated

Was this helpful?