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 “ThingUserDefinedPropertiesAction” 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:SMvLmYkkIVSYrrEQZSix0Q' -d '{"rule_key":"a24e3747bd"}' https://api.datonis.io/api/v3/notification_actions Response (returns first 20 records) { "total_count": 3, "page": 1, "notification_actions": [ { "bcc": "", "body": null, "cc": "john@acme.com", "created_at": 1448514905, "notification_action_key": "e18c3t386e", "subject": null, "to": "bill@acme.com", "updated_at": 1448514905, "type": "EmailNotificationAction" }, { "body": "{\"user_defined_properties\":{\"Status\":\"Green\"}}", "created_at": 1448515099, "headers": { }, "method": "PUT", "notification_action_key": "4d1d745e94", "query": { }, "updated_at":...
curl -X GET -H "Content-Type:application/json" -H 'X-Auth-Token:SMvLmYkkIVSYrrEQZSix0Q' -d '{"rule_key":"a24e3747bd", "per":"2", "page":"2"}' https://api.datonis.io/api/v3/notification_actions Response (returns page 2 with 2 notification actions per page) { "total_count": 3, "page": "2", "notification_actions": [ { "body": "", "created_at": 1448514914, "headers": { }, "method": "GET", "notification_action_key": "dt1b22767c", "query": { }, "updated_at": 1448514914, "url": "http://epochconverter.com", "type": "CallHttpUrlAction" } ] }
Request - listing notification actions ordered by a field curl -X GET -H "Content-Type:application/json" -H 'X-Auth-Token:SMvLmYkkIVSYrrEQZSix0Q' -d '{"rule_key":"a24e3747bd", "order_by":"type", "order":"desc"}' https://api.datonis.io/api/v3/notification_actions Response (returns notification in the reverse order of type) { "total_count": 3, "page": 1, "notification_actions": [ { "bcc": "", "body": null, "cc": "john@acme.com", "created_at": 1448514905, "notification_action_key": "e18c3t386e", "subject": null, "to": "bill@acme.com", "updated_at": 1448514905, "type": "EmailNotificationAction" }, { "body": "{\"user_defined_properties\":{\"Status\":\"Green\"}}", "created_at": 1448515099, "headers": { }, "method": "PUT", "notification_action_key": "4d1d745e94", "query": { }, "updated_at": 1448515099, "url": "http://localhost:3000/api/v3/things/$THING$/set_user_defined_properties", "type": "ThingUserDefinedPropertiesAction" }, { "body": "", "created_at": 1448514914, "headers": { }, "method": "GET", "notification_action_key": "dt1b22767c", "query": { }, "updated_at": 1448514914, "url":...
Request - listing notification based on action type curl -X GET -H "Content-Type:application/json" -H 'X-Auth-Token:SMvLmYkkIVSYrrEQZSix0Q' -d '{"rule_key":"a24e3747bd", "type":"EmailNotificationAction"}' https://api.datonis.io/api/v3/notification_actions Response (returns notification actions of type "EmailNotificationAction") { "total_count": 1, "page": 1, "notification_actions": [ { "bcc": "", "body": null, "cc": "john@acme.com", "created_at": 1448514905, "notification_action_key": "e18c3t386e", "subject": null, "to": "bill@acme.com", "updated_at": 1448514905, "type": "EmailNotificationAction" } ] }
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:SMvLmYkkIVSYrrEQZSix0Q' https://api.datonis.io/api/v3/notification_actions/e18c3t386e Response (details of the notification action requested) { "notification_action": { "bcc": "", "body": null, "cc": "john@acme.com", "created_at": 1448514905, "notification_action_key": "e18c3t386e", "subject": null, "to": "bill@acme.com", "updated_at": 1448514905, "type": "EmailNotificationAction" } }
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" * ThingUserDefinedPropertiesAction : Mandatory Parameters - "body". body format {"user_defined_properties" => {$key=>$value}} * SMSNotificationAction : Mandatory Parameters - "name", "phone_number" 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:SMvLmYkkIVSYrrEQZSix0Q" -d '{"notification_action":{"type":"EmailNotificationAction","rule_key":"a24e3747bd","to":"bill@acme.com","cc":"bob@acme.com","bcc":"john@acme.com"}}' https://api.datonis.io/api/v3/notification_actions Response (details of the notification action created) { "notification_action": { "bcc": "john@acme.com", "body": null, "cc": "bob@acme.com", "created_at": 1448515909, "notification_action_key": "49ffa24fet", "subject": null, "to": "bill@acme.com", "updated_at": 1448515909, "type": "EmailNotificationAction" } }
Request - to create a call http url action curl -X POST -H "Content-Type:application/json" -H "X-Auth-Token:SMvLmYkkIVSYrrEQZSix0Q" -d '{"notification_action":{"type":"CallHttpUrlAction","rule_key":"a24e3747bd","method":"POST","url":"https://api.datonis.io/api/v3/things"}}' https://api.datonis.io/api/v3/notification_actions Response (details of the notification action created) { "notification_action": { "body": "", "created_at": 1448516142, "headers": { }, "method": "POST", "notification_action_key": "7b6f47t5f5", "query": { }, "updated_at": 1448516142, "url": "https://api.datonis.io/api/v3/things", "type": "CallHttpUrlAction" } }
Request - to create a set thing user defined property action curl -X POST -H "Content-Type:application/json" -H "X-Auth-Token:SMvLmYkkIVSYrrEQZSix0Q" -d '{"notification_action":{"type":"ThingUserDefinedPropertiesAction","rule_key":"a24e3747bd","body":{"user_defined_properties":{"Status":"Red"}}}}' https://api.datonis.io/api/v3/notification_actions Response (details of the notification action created) { "notification_action": { "body": "{\"user_defined_properties\":{\"Status\":\"Red\"}}", "created_at": 1448516262, "headers": { }, "method": "PUT", "notification_action_key": "e4b268b9ca", "query": { }, "updated_at": 1448516262, "url": "http://localhost:3000/api/v3/things/$THING$/set_user_defined_properties", "type": "ThingUserDefinedPropertiesAction" } }
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" * ThingUserDefinedPropertiesAction : Optional Parameters - "body". body format {"user_defined_properties" => {$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:SMvLmYkkIVSYrrEQZSix0Q" -d '{"notification_action":{"type":"EmailNotificationAction","to":"bill@acme.com","cc":"bob@acme.com","bcc":"john@acme.com"}}' https://api.datonis.io/api/v3/notification_actions/49ffa24fet Response (details of the notification action updated) { "notification_action": { "bcc": "john@acme.com", "body": null, "cc": "bob@acme.com", "created_at": 1448515909, "notification_action_key": "49ffa24fet", "subject": null, "to": "bill@acme.com", "updated_at": 1448516424, "type": "EmailNotificationAction" } }
Request - update a call http url action curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:SMvLmYkkIVSYrrEQZSix0Q" -d '{"notification_action":{"type":"CallHttpUrlAction","method":"GET","url":"https://api.datonis.io/api/v3/things"}}' https://api.datonis.io/api/v3/notification_actions/7b6f47t5f5 Response (details of the notification action updated) { "notification_action": { "body": "", "created_at": 1448516142, "headers": { }, "method": "GET", "notification_action_key": "7b6f47t5f5", "query": { }, "updated_at": 1448516553, "url": "https://api.datonis.io/api/v3/things", "type": "CallHttpUrlAction" } }
Request - update a thing user defined property action curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:SMvLmYkkIVSYrrEQZSix0Q" -d '{"notification_action":{"type":"ThingUserDefinedPropertiesAction","body":{"user_defined_properties":{"Status":"Green"}}}}' https://api.datonis.io/api/v3/notification_actions/e4b268b9ca Response (details of the notification action updated) { "notification_action": { "body": "{\"user_defined_properties\":{\"Status\":\"Green\"}}", "created_at": 1448516262, "headers": { }, "method": "PUT", "notification_action_key": "e4b268b9ca", "query": { }, "updated_at": 1448516768, "url": "http://localhost:3000/api/v3/things/$THING$/set_user_defined_properties", "type": "ThingUserDefinedPropertiesAction" } }
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:SMvLmYkkIVSYrrEQZSix0Q" https://api.datonis.io/api/v3/notification_actions/e4b268b9ca Response { }