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", ...
Returns details of the specified notification action
Param name | Description |
---|---|
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
Request - get details of the specified notification (notification_action_key specified as a part of the url) curl -X GET -H "Content-Type:application/json" -H 'X-Auth-Token:RRxnt_0gBxeo0fNQOdObTw' https://api.datonis.io/api/v2/notification_actions/67ff65b815 Response (details of the notification action requested) { "notification_action": { "body": "", "headers": { }, "method": "GET", "notification_action_key": "67ff65b815", "query": { }, "url": "http://examplehost.outgoingdomain.com/some_get", "type": "CallHttpUrlAction", "created_at": 1418889738, "updated_at": 1418889738 } }
Creates a notification action with given parameters
Param name | Description |
---|---|
notification_action required |
Map containing the details of the notification action to be created Mandatory keys that should be sent from within the hash: type: type of notification action to create, can be one of: * EmailNotificationAction : Mandatory Parameters - "to", Optional Parameters - "cc", "bcc" * CallHttpUrlAction : Mandatory Parameters - "url", "method" * SensorTraitsAction : Mandatory Parameters - "body". body format {"traits" => {$key=>$value}} rule_key: rule_key of the rule for which the action should be associated Value: Must be a Hash |
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
Request - to create an email notification action curl -X POST -H "Content-Type:application/json" -H "X-Auth-Token:dpxgzEi6AzqMNgPrCUSxSg" -d '{"notification_action":{"type":"EmailNotificationAction","rule_key":"66132eb8c1","to":"bob@acme.com","cc":"bill@acme.com","bcc":"ranjit@acme.com"}}' https://api.datonis.io/api/v2/notification_actions Response (details of the notification action created) { "notification_action": { "bcc": "ranjit@acme.com", "body": null, "cc": "bill@acme.com", "created_at": "2015-04-14T06:19:27.710Z", "notification_action_key": "baatafc1e7", "subject": null, "to": "bob@acme.com", "updated_at": "2015-04-14T06:19:27.710Z", "type": "EmailNotificationAction" } }
Request - to create a call http url action curl -X POST -H "Content-Type:application/json" -H "X-Auth-Token:dpxgzEi6AzqMNgPrCUSxSg" -d '{"notification_action":{"type":"CallHttpUrlAction","rule_key":"66132eb8c1","method":"POST","url":"http://examplehost.com/example_url"}}' https://api.datonis.io/api/v2/notification_actions Response (details of the notification action created) { "notification_action": { "body": "", "created_at": "2015-04-14T06:23:40.443Z", "headers": { }, "method": "POST", "notification_action_key": "e45cf984c8", "query": { }, "updated_at": "2015-04-14T06:23:40.443Z", "url": "http://examplehost.com/example_url", "type": "CallHttpUrlAction" } }
Request - to create a set sensor trait action curl -X POST -H "Content-Type:application/json" -H "X-Auth-Token:dpxgzEi6AzqMNgPrCUSxSg" -d '{"notification_action":{"type":"SensorTraitsAction","rule_key":"66132eb8c1","body":{"traits":{"Status":"Green"}}}}' https://api.datonis.io/api/v2/notification_actions Response (details of the notification action created) { "notification_action": { "body": "{\"traits\":{\"Status\":\"Green\"}}", "created_at": "2015-04-14T07:13:03.117Z", "headers": { }, "method": "PUT", "notification_action_key": "2131aacfte", "query": { }, "updated_at": "2015-04-14T07:13:03.117Z", "url": "http://api.datonis.io/api/v1/sensors/$SENSOR$/set_traits", "type": "SensorTraitsAction" } }
Updates the notification with given parameters
Param name | Description |
---|---|
notification_action required |
Map containing the details of the notification action to be updated Mandatory keys that should be sent from within the hash: type: type of notification action to create, can be one of: * EmailNotificationAction : Optional Parameters - "to", "cc", "bcc" * CallHttpUrlAction : Optional Parameters - "url", "method" * SensorTraitsAction : Optional Parameters - "body". body format {"traits" => {$key=>$value}} Optional keys: rule_key: rule_key of the rule for which the action should be associated Value: Must be a Hash |
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
Request - update an email notification action curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:dpxgzEi6AzqMNgPrCUSxSg" -d '{"notification_action":{"type":"EmailNotificationAction","to":"ranjit@acme.com","cc":"bob@acme.com","bcc":"bill@acme.com"}}' https://api.datonis.io/api/v2/notification_actions/d83et2e5ae Response (details of the notification action updated) { "notification_action": { "bcc": "bill@acme.com", "body": null, "cc": "bob@acme.com", "notification_action_key": "d83et2e5ae", "subject": null, "to": "ranjit@acme.com", "type": "EmailNotificationAction" } }
Request - update a call http url action curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:dpxgzEi6AzqMNgPrCUSxSg" -d '{"notification_action":{"type":"CallHttpUrlAction","method":"PUT","url":"http://examplehost.com/example_put_url"}}' https://api.datonis.io/api/v2/notification_actions/e45cf984c8 Response (details of the notification action updated) { "notification_action": { "body": "", "headers": { }, "method": "PUT", "notification_action_key": "e45cf984c8", "query": { }, "url": "http://examplehost.com/example_put_url", "type": "CallHttpUrlAction" } }
Request - update a sensor trait action curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:dpxgzEi6AzqMNgPrCUSxSg" -d '{"notification_action":{"type":"SensorTraitsAction","body":{"traits":{"Status":"Red"}}}}' https://api.datonis.io/api/v2/notification_actions/2131aacfte Response (details of the notification action updated) { "notification_action": { "body": "{\"traits\":{\"Status\":\"Red\"}}", "headers": { }, "method": "PUT", "notification_action_key": "2131aacfte", "query": { }, "url": "http://api.datonis.io/api/v1/sensors/$SENSOR$/set_traits", "type": "SensorTraitsAction" } }
Deletes the specified notification action from the system
Param name | Description |
---|---|
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
Request curl -X DELETE -H "Content-Type:application/json" -H "X-Auth-Token:dpxgzEi6AzqMNgPrCUSxSg" https://api.datonis.io/api/v2/notification_actions/2131aacfte Response { }