Summary:
List and create custom webhook rules.
URL:
http(s)://{server hostname}/api/webhooks/rules
Methods summary
- GET Method - list custom webhook rules
- POST Method - create a custom webhook rule
GET Method detail
Returns a list of custom webhook rules.
Response:
Same parameter fields as used below in the POST Method to create a webhook rule, plus an allocated ruleID.
Example:
INPUT
curl -u admin:admin https://localhost/api/webhooks/rules -H "content-type:application/json"
OUTPUT
{
"items" : [ {
"ruleID" : 11,
"ruleName" : "Meraki Device Up Rule",
"groupID" : 23,
"conditions" : [ {
"eventConditionID" : 9,
"fieldToTest" : "${deviceName}",
"valueToMatch" : "My AP.*",
"operator" : "LIKE",
"transformType" : "STRING",
"result" : false
} ],
"eventMapping" : {
"eventMappingID" : 8,
"eventSource" : "${deviceName} on ${networkName} ",
"eventDetails" : "${deviceModel} ",
"webhookEvent" : {
"eventName" : "Meraki Device Came Up",
"eventDescription" : "Test Meraki Device Came Up Event",
"eventID" : 8,
"eventSeverity" : 6
},
"eventName" : "Meraki Device Came Up",
"eventID" : 8
},
"enabled" : 1,
"payloadID" : 15
} ],
"count" : 1
}
POST Method detail
Create a new custom webhook rule.
Request:
Name | Description |
---|---|
ruleName | name of the rule. |
groupID | id of the webhook group to which this rule will apply. |
conditions | set of conditions that determine whether the webhook payload meets the requirements for raising a webhook event. |
fieldToTest | key from which the value will be retrieved. |
valueToMatch | value to compare to the value from the payload. |
operator | operation that the value will use. |
transformType |
type into which the value will be converted, from the following:
|
eventMapping | set of parameters by which to map the webhook event. |
eventSource | informational entry of the event source. |
eventDetails | informational entry of the event details |
eventName | name of the custom webhook event. |
eventDescr | description of the event. This is informational only. |
eventSeverity |
severity of the event, select from: 2 - Info 4 - Minor 6 - Major 8 - Severe 10 - Critical |
attachPayload | if the webhook payload is to be attached to the generated event as a custom attribute (called 'webhookPayload'), either "true" or "false". |
Example
INPUT
curl -v -u -k admin:admin https://localhost/api/webhooks/rules -X POST -H "content-type:application/json" -d\
'{
"ruleName" : "Meraki Device Reboot",
"groupID" : 1,
"conditions" : [ {
"fieldToTest" : "alertType",
"valueToMatch" : ".*came up",
"operator" : "LIKE",
"transformType" : "STRING"
} ],
"eventMapping" : {
"eventSource" : "${deviceName} on ${networkName}",
"eventDetails" : "${deviceName} down",
"webhookEvent" : {
"eventName" : "Meraki Device Reboot",
"eventDescr" : "Test",
"eventSeverity" : "8"
}
}
"attachPayload" : true
}
OUTPUT
{
"successcCount" : 1,
"failureCount" : 0,
"errorCode" : 0,
"message" : "Webhook rule 'Meraki Device Reboot' created successfully.",
"otherResults" : []
}
Comments
0 comments
Please sign in to leave a comment.