HTTP Custom Action
HTTP actions can be created or edited per enterprise. The user can templatize the action to pick values from a generated alert. The HTTP action can be configured with retries.
Example of an HTTP Custom Action:
{
"name": "simpleAction",
"type": "HTTP_ACTION",
"url": "http://localhost:8080/device/${SERIALNUMBER}/job/1/execute",
"headers": {
"Content-Type": "application/json"
"tenant": "${GROUPNAME}"
},
"method": "POST",
"body": "{\"severity\":\"${SEVERITY}\"}",
"certificateType": "JKS",
"certificate": "<Base64 encoded jks certificate string>"
"properties": {
"retryPolicy": "FIXED",
"initialPeriod": "5000",
"maxPeriod": "300000",
"maxAttempts": "3",
"requestsPerSecond": "60"
}
}
Field | Descriptions |
---|---|
*id | The unique ID of the action, which is used while accessing
various rules APIs. This is also used while associating this custom
action to a rule. Refer to customActions field in rule
creation. *Read-only parameter. |
name | Name of the action. Must be unique within the tenant. Can contain alphanumeric characters and underscore. |
*type | Type of action. Supported value:
HTTP_ACTION * Mandatory parameter. |
*group | The tenant for which the action is created. This is set according
to the tenant of the user creating the action, or the impersonated
tenant set with tenant header. *Read-only parameter. |
*url | The URL of the HTTP endpoint which needs to be called for per
record created by the rule. * Mandatory parameter. |
headers | HTTP headers to be sent while making the HTTP call. Takes a map
of key-value pairs. Optional parameter. |
*method | The HTTP method to be used when making the HTTP call. Can be
among GET, POST, PUT, PATCH, DELETE. * Mandatory parameter. |
body | Must contain the request body to be sent during the HTTP
call. Optional parameter. |
certificateType | To be specified if HTTPS url is used. Currently supported: JKS
(Default). Optional parameter. |
certificate | To be specified if HTTPS url is used. If certificateType is JKS,
this should be the base64 encoded JKS certificate. This string can
be generated on Linux machines using the Base64 encoding command:
base64 -w0 certificateFile.jks Optional parameter. |
properties | Optional parameter. If this is not set, the values are
initialized to its default.
|
The following three fields in the action body can be customized to use the values from the record. For each record, the placeholders will be replaced with the value in that record, and the call will then be made.
- url
- headers
- body
To refer to a variable, the following syntax has to be used:
${<variable name>}
For the list of variables that can be referred to like this, refer to Alerts Schema and Aggregation Schema in Appendix F: Messaging Schema in Connect Deployment guide, according to the requirement of the rule to which this action will be bound. These variables need to be referred to in all-caps. Along with this, all the keys from the details map can also be used as variables. match the case sensitivity according to the alias provided for these fields during rule creation in the select field.