Returns a list of all notification actions belonging to an account as per the specified criteria. This API is paginated and returns 20 actions by default. An action is uniquely identified by a 'notification_action_key'. This key should be used in all the other API referencing a particular notification action.
| Param name | Description |
|---|---|
|
page optional |
Page number of results to be fetched, Default 1 Value: Must be Integer. |
|
per optional |
Number of notification actions to be returned in one page, Default 20 Value: Must be Integer. |
|
order_by optional |
Field on which results should be sorted Value: Must be a String |
|
order optional |
Order, “asc” or “desc”, in which results should be sorted Value: Must be a String |
|
search optional |
Keywords based on which notfication actions should be searched. Currently not supported Value: Must be a String |
|
scope optional |
Matching condition if multiple keywords are specified for search. Currently not supported Value: Must be a String |
|
rule_key required |
Mandatory, rule_key in string format. Value: Must be a String |
|
type optional |
Optional, one from “EmailNotificationAction”, “CallHttpUrlAction” or “SensorTraitsAction” Value: Must be a String |
|
timestamp_format optional |
Format, “str” or “int”, in which timestamps should be returned, Default “int” Value: Must be a String |
|
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
Request - listing all notification actions associated with a rule
curl -X GET -H "Content-Type:application/json" -H 'X-Auth-Token:RRxnt_0gBxeo0fNQOdObTw' -d '{"rule_key":"t2514225a7"}' https://api.datonis.io/api/v2/notification_actions
Response (returns first 20 records)
{
"total_count": 4,
"page": 1,
"notification_actions": [
{
"created_at": 1418889738,
"updated_at": 1418889738,
"bcc": "",
"body": null,
"cc": "",
"notification_action_key": "t4be4b3917",
"subject": null,
"to": "bob@acme.com",
"type": "EmailNotificationAction"
},
{
"body": "",
"headers": {
},
"method": "POST",
"notification_action_key": "3de914e4d3",
"query": {
},
"url": "http://examplehost.outgoingdomain.com/some_update",
"type": "CallHttpUrlAction",
"created_at":...
Request - listing notification actions by specifying number of actions to be returned at a time (page size) and specific set to be returned (page)
curl -X GET -H "Content-Type:application/json" -H 'X-Auth-Token:RRxnt_0gBxeo0fNQOdObTw' -d '{"rule_key":"t2514225a7", "per":"2", "page":"2"}' https://api.datonis.io/api/v2/notification_actions
Response (returns page 2 with 2 notification actions per page)
{
"total_count": 4,
"page": "2",
"notification_actions": [
{
"body": "{\"traits\":{\"Status\":\"Green\"}}",
"headers": {
},
"method": "PUT",
"notification_action_key": "t954693bf7",
"query": {
},
"url": "http://api.datonis.io/api/v1/sensors/$SENSOR$/set_traits",
"type": "SensorTraitsAction",
"created_at": 1418889738,
"updated_at": 1418889738
},
{
"body": "",
"headers": {
},
"method": "GET",
"notification_action_key": "67ff65b815",
"query": {
},
"url":...
Request - listing notification actions ordered by a field
curl -X GET -H "Content-Type:application/json" -H 'X-Auth-Token:RRxnt_0gBxeo0fNQOdObTw' -d '{"rule_key":"t2514225a7", "order_by":"type", "order":"desc"}' https://api.datonis.io/api/v2/notification_actions
Response (returns notification in the reverse order of type)
{
"total_count": 4,
"page": 1,
"notification_actions": [
{
"bcc": "",
"body": null,
"cc": "",
"notification_action_key": "t4be4b3917",
"subject": null,
"to": "bob@acme.com",
"type": "EmailNotificationAction",
"created_at": 1418889738,
"updated_at": 1418889738
},
{
"body": "",
"headers": {
},
"method": "POST",
"notification_action_key": "3de914e4d3",
"query": {
},
"url": "http://examplehost.outgoingdomain.com/some_update",
"type": "CallHttpUrlAction",
"created_at": 1418889738,
"updated_at": 1418889738
},
{
"body": "{\"traits\":{\"Status\":\"Green\"}}",
"headers": {
},
"method": "PUT",
"notification_action_key": "t954693bf7",
"query": {
},
"url": "http://api.datonis.io/api/v1/sensors/$SENSOR$/set_traits",
"type": "SensorTraitsAction",
"created_at": 1418889738,
"updated_at":...
Request - listing notification based on action type
curl -X GET -H "Content-Type:application/json" -H 'X-Auth-Token:RRxnt_0gBxeo0fNQOdObTw' -d '{"rule_key":"t2514225a7", "type":"CallHttpUrlAction"}' https://api.datonis.io/api/v2/notification_actions
Response (returns notification actions of type "CallHttpUrlAction")
{
"total_count": 2,
"page": 1,
"notification_actions": [
{
"body": "",
"headers": {
},
"method": "POST",
"notification_action_key": "3de914e4d3",
"query": {
},
"url": "http://examplehost.outgoingdomain.com/some_update",
"type": "CallHttpUrlAction",
"created_at": 1418889738,
"updated_at": 1418889738
},
{
"body": "",
"headers": {
},
"method": "GET",
"notification_action_key": "67ff65b815",
"query": {
},
"url": "http://examplehost.outgoingdomain.com/some_get",
...