Skip to main content

getSituationActions

A Graze API GET request that returns the actions for Situations, ordered most recent last. You can use the from and to arguments to specify a period that you want to retrieve Situation actions for. If you do not specify these, actions for all dates and times are returned.

Back to Graze API EndPoint Reference.

Request arguments

Endpoint getSituationActions takes the following request arguments:

Name

Type

Required

Description

auth_token

String

Yes

A valid auth_token returned from the authenticate request. Alternatively, basic authenticate headers can be used in place of this parameter. See the authenticate endpoint for more information and usage examples.

sitn_ids

Array of Numbers

No, if you specify from and to.

Array of Situation IDs that the actions are requested for.

start

Integer

Yes

Number of the first action to return.

limit

Integer

Yes

Maximum number of actions that you want to return.

actions

Array of Numbers

No

List of action codes. Returns all action codes if no action codes are specified. See Situation Action Codes for a list of action codes and their descriptions.

from

Number

No

Start time of the period you want to retrieve Situation actions for. This is a Unix epoch timestamp in seconds.

to

Number

No

End time of the period you want to retrieve Situation actions for. This is a Unix epoch timestamp in seconds.

Response

Endpoint getSituationActions returns the following response:

Successful requests return an array of JSON objects containing the following:

Name

Type

Description

activities

Array

An array of objects containing the Situation action details.

Examples

The following examples demonstrate typical use of endpoint getSituationActions:

Request examples

Example cURL request to retrieve the first three actions for Situations 1, 2, 3 and 6:

curl -G -u graze:graze -k -v "https://localhost/graze/v1/getSituationActions" \
--data-urlencode "sitn_ids=[1, 2, 3, 6]" \
--data-urlencode "actions=[1]" \
--data-urlencode "limit=3" \
--data-urlencode "start=0"

Example cURL command to retrieve the first 50 actions for Situations 1, 2, 3 and 6 between Unix epoch times 1553861746 and 1553872546:

curl -G -u graze:graze -k -v "https://localhost/graze/v1/getSituationActions" \
--data-urlencode "sitn_ids=[1, 2, 3, 6]" \
--data-urlencode "actions=[1]" \
--data-urlencode "limit=50" \
--data-urlencode "start=0" \
--data-urlencode "from=1553861746"
--data-urlencode "to=1553872546"

Response example

Example response returning the actions for Situation 451:

{
    "activities": [
    {
        "uid": 2,
        "action_code": 1,
        "description": "Situation Created",
        "details": {},
        "type": "event",
        "sig_id": 451,
        "timed_at": 1507039842
    },
    {
        "uid": 2,
        "action_code": 14,
        "description": "Added Alerts To Situation",
        "details": {}
        "alerts": [1, 2]
    },
    {
        "uid": 3,
        "action_code": 11,
        "description": "Ran Tool",
        "details": 
        {
	    "tool_id": 271,
	    "tool": "get data"
        },
        "sig_id": 451,
        "type": "event",
        "timed_at": 1557321088,
        "username": "admin"
    }]
}