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 |
---|---|---|---|
| String | Yes | A valid |
| Array of Numbers | No | List of alert IDs. |
| Integer | Yes | Starting row from which data should be included. |
| Integer | Yes | Maximum number of actions you want to return. |
| 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. |
| Number | No | Start time of the period you want to retrieve alert actions for. This is in Unix epoch time in seconds. |
| 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 |
---|---|---|
| Number | User ID. |
| Number list | Code for the action in the JSON object. See Alert Action Codes for a list of action codes and their descriptions. |
| String | Description of the action. |
| String | Details of the action. |
| String | Type of action. |
| Integer | Alert ID. |
| 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" }]