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