updateClosedSituation

A Graze API POST request that updates the description and custom info of a closed Situation during the grace period. The grace period is when a Situation is closed and in the active database, before it is archived to the historic database. If a custom info field already exists, this endpoint replaces the previous value; if a custom info field does not exist, this endpoint adds it.

The updateClosedSituation endpoint returns an error if the Situation is open, or if it is closed and has been archived to the historic database.

Back to Graze API EndPoint Reference.

Request arguments

Endpoint updateClosedSituation takes the following request arguments:

Name

Type

Required

Description

auth_token

String

Yes

A valid auth_token returned from the authenticate request. See the authenticate endpoint for more information.

sitn_id

Number

Yes

ID of the closed Situation that you want to update.

description

String

No

New description of the Situation.

custom_info

JSON Object

No

A JSON object containing the custom info values that you want to update. If the key already exists, the endpoint replaces the existing value. If the key does not exist, the endpoint adds it.

Response

Endpoint updateClosedSituation returns the following response:

API update behavior

The behavior of this endpoint depends on whether the relevant alert or Situation is open, closed and still in the active database, or closed and archived to the historic database. This endpoint updates the alert or Situation as follows:

See API Update Behavior for more information on Situation statuses.

Examples

The following examples demonstrate typical use of endpoint updateClosedSituation:

Request examples

Request example to replace description and custom info

Example cURL request to update the description and custom info for Situation ID 555. The description value "new_desc" replaces the previous value. If the custom info fields field1 and field2 did not exist, the endpoint adds them. If the custom info fields field1 and field2 did previously exist, the endpoint overwrites them with the values "value1" and "value2".

curl -X POST -u graze:graze -k -v "https://localhost/graze/v1/updateClosedSituation" -H "Content-Type: application/json; charset=UTF-8" -d '{ \
"sitn_id" : 555, \
"description":"new_desc", \
"custom_info": { \
    "field1": "value1", \
    "field2": "value2" \
    } \
}'

Request example to update custom info

Example cURL request to update the custom info for Situation ID 555.

curl -X POST -u graze:graze -k -v "https://localhost/graze/v1/updateClosedAlert" -H "Content-Type: application/json; charset=UTF-8" -d '{ \
"sitn_id" : 555, \
"custom_info": { \
    "field1": "new_value1", \
    "field3": "value3" \
    } \
}'

If the Situation custom info contained the following fields before the cURL request:

  • field1: value1

  • field2: value2

After the cURL request, the Situation custom info contains the following fields. field1 has been overwritten, field2 is unchanged, and field3 has been added.

  • field1: new_value1

  • field2: value2

  • field3: value3

Response example