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"
}
}