Skip to main content

getAlertActions

A Graze API GET request that returns the actions for one or more alerts, ordered most recent last. You can use the from and to arguments to specify a period that you want to retrieve alert 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 getAlertActions 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.

alert_ids

Array of Numbers

No

List of alert IDs.

start

Integer

Yes

Starting row from which data should be included.

limit

Integer

Yes

Maximum number of actions you want to return.

actions

Array of Numbers

No

List of action codes. If no action codes are specified, all action codes are returned. See Alert Action Codes for a list of action codes and their descriptions. Only action codes 8 (Alert Resolved) and 9 (Alert Closed) are valid.

from

Number

No

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

to

Number

No

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

Response

Endpoint getAlertActions returns the following response:

Successful requests return a JSON object which contains alert details from the following:

Name

Type

Description

uid

Number

User ID.

action_code

Number list

Code for the action in the JSON object. See Alert Action Codes for a list of action codes and their descriptions.

description

String

Description of the action.

details

String

Details of the action.

type

String

Type of action.

alert_id

Integer

Alert ID.

timed_at

Integer

Timestamp of the action.

Examples

The following examples demonstrate typical use of endpoint getAlertActions:

Request Examples

Example cURL request to return the first 50 actions for alert IDs 1, 2, 3, and 6 for action codes 8 (Alert Resolved) and 9 (Alert Closed):

curl -G -u graze:graze -k -v "https://localhost/graze/v1/getAlertActions" --data-urlencode 'alert_ids=[1, 2, 3, 6]' --data-urlencode 'actions=[8, 9]' --data-urlencode 'limit=50' --data-urlencode 'start=0'

Example cURL request to return the first 50 actions for action codes 8 (Alert Resolved) and 9 (Alert Closed) between Unix epoch times 1553861746 and 1553872546:

curl -G -u graze:graze -k -v "https://localhost/graze/v1/getAlertActions" --data-urlencode 'actions=[8, 9]' --data-urlencode 'limit=50' --data-urlencode 'start=0' --data-urlencode 'from=1553861746' --data-urlencode 'to=1553872546'

Response example

Example response returning the actions for alert ID 313:

[{ 
      "uid": 49, 
      "action_code": 9, 
      "description": "Alert Closed", 
      "details": {}, 
      "alert_id": 313, 
      "timed_at": 1557504912
 },{ 
      "uid": 49, 
      "action_code": 8, 
      "description": "Alert Resolved", 
      "details": {}, 
      "alert_id": 313, 
      "timed_at": 1557504393 
 },{
      "uid": 3,
      "action_code": 10,
      "description": "Ran Tool",
      "details": {
              "tool_id": 271,
	      "tool": "get data"
          },
      "alert_id": 313,
      "type": "event",
      "timed_at": 1557321088,
      "username": "admin"
}]