This documentation and the Cisco Observability Platform functionalities it describes are subject to change. Data saved on the platform may disappear and APIs may change without notice.


actions:httpactiontemplate

Description

Describes the schema to create an HTTP request action. For more information, see Actions.

Syntax

"jsonSchema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "title": "Default HTTP Action Configuration Schema Definition",
        "description": "Specification for a configuration of kind http-action-template.",
        "type": "object",
        "required": ["name", "tagName"],
        "properties": {
            "name": {
                "type": "string",
                "description": "A configuration name that is unique with this namespace.",
                "example": "HTTP Action: Appdynamics Default"
            },
            "tagName": {
                "type": "string",
                "description": "specifies which endpoint will this template call ( i.e. ServiceNow, PagerDuty, etc )",
                "example": "PagerDuty"
            },
            "maxRedirects": {
                "type": "integer",
                "description": "maximum allowed redirects for the HTTP call",
                "minimum": 0,
                "default": 5
            },
            "overallTimeoutMillis": {
                "type": "integer",
                "description": "milliseconds after which the HTTP call should timeout",
                "minimum": 0,
                "maximum": 300000,
                "default": 2000
            },
            "socketTimeoutMillis": {
                "type": "integer",
                "description": "milliseconds after which the HTTP call should timeout",
                "minimum": 0,
                "maximum": 150000,
                "default": 1000
            },
            "connectionTimeoutMillis": {
                "type": "integer",
                "description": "milliseconds after which the HTTP call should timeout",
                "minimum": 0,
                "maximum": 150000,
                "default": 1000
            },
            "requestParameters": {
                "type": "object",
                "description": "HTTP details ( URL, method, encoding )",
                "required": ["rawUrl", "requestType"],
                "properties": {
                    "rawUrl": {
                        "type": "string",
                        "description": "where should a HTTP call be made",
                        "example": "https://appdynamics.com/desired-path/${custom-variable}"
                    },
                    "requestType": {
                        "type": "string",
                        "description": "which method to use while calling rawUrl",
                        "enum": ["GET", "PUT", "POST", "DELETE", "PATCH"]
                    },
                    "encodingType": {
                        "$ref": "#/definitions/Encoding"
                    }
                },
                "additionalProperties": false
            },
            "requestHeaders": {
                "type": "array",
                "description": "headers to be manually added in the request",
                "items": {
                    "$ref": "#/definitions/KeyValuePair"
                },
                "example": [{ "authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ=" }, { "x-custom-header": "custom header value" }]
            },
            "customVariables": {
                "type": "array",
                "description": "custom variables to be substituted throughout the request",
                "items": {
                    "$ref": "#/definitions/KeyValuePair"
                },
                "example": [
                    { "key": "ui", "value": "https://tenant-name.observe.appdynamics.com" },
                    { "key": "logo-link", "value": "https://appdynamics.com/favicon.ico" }
                ]
            },
            "requestPayload": {
                "type": "object",
                "description": "payload data to be sent with the request",
                "required": [],
                "properties": {
                    "contentType": {
                        "$ref": "#/definitions/ContentType"
                    },
                    "rawPayload": {
                        "type": "string",
                        "description": "specifies the payload in raw format",
                        "example": "{\"property\": \"property value\", \"entity\":\"${eventList[0].entity_id}\"}"
                    },
                    "formData": {
                        "type": "array",
                        "description": "form like data to be sent with the request",
                        "items": {
                            "$ref": "#/definitions/KeyValuePair"
                        },
                        "example": [
                            { "key": "field", "value": "field value" },
                            { "key": "entity", "value": "${eventList[0].entity_id}" }
                        ]
                    },
                    "encodingType": {
                        "$ref": "#/definitions/Encoding"
                    }
                },
                "additionalProperties": false
            },
            "successCriteria": {
                "type": "array",
                "description": "if any criteria here matches the HTTP call is marked as success",
                "items": {
                    "$ref": "#/definitions/HttpResponseCriteria"
                },
                "example": [{ "statusCode": 200 }, { "statusCode": 201, "expectPayload": true }]
            },
            "failureCriteria": {
                "type": "array",
                "description": "if any criteria here matches the HTTP call is marked as failure",
                "items": {
                    "$ref": "#/definitions/HttpResponseCriteria"
                },
                "example": [{ "statusCode": 500 }, { "statusCode": 400, "expectPayload": true }]
            }
        },
        "definitions": {
            "ContentType": {
                "type": "string",
                "description": "specifies content type either to be sent to to be received in a HTTP call",
                "example": "application/json",
                "default": "text/plain"
            },
            "Encoding": {
                "type": "string",
                "description": "specifies the encoding",
                "enum": ["UTF-8", "ISO-8859-1"],
                "default": "UTF-8"
            },
            "KeyValuePair": {
                "type": "object",
                "description": "stores a key value pair",
                "required": ["key", "value"],
                "properties": {
                    "key": {
                        "type": "string",
                        "description": "stores the key in the pair",
                        "example" : "ui"
                    },
                    "value": {
                        "type": "string",
                        "description": "stores the value in the pair",
                        "example" : "https://tenant-name.observe.appdynamics.com"
                    }
                },
                "additionalProperties": false
            },
            "HttpResponseCriteria": {
                "type": "object",
                "description": "defines a criteria to matched after a HTTP response is received",
                "required": ["statusCode"],
                "properties": {
                    "statusCode": {
                        "type": "integer",
                        "description": "expected status code for this criteria to match",
                        "example": 201
                    },
                    "expectPayload": {
                        "type": "boolean",
                        "description": "does the received response has a payload with it",
                        "default": false
                    },
                    "contentType": {
                        "$ref": "#/definitions/ContentType"
                    }
                },
                "additionalProperties": false
            }
        },
        "additionalProperties": false
    }
}

Attributes

The following table describes the attributes of the HTTP request action schema:

Attribute Description Type Example
name Indicates the unique name to identify the HTTP request action template. string Alert for Webex
tagName Indicates the endpoint (application) for which the HTTP request action is configured. string ServiceNow, PagerDuty, Webex, Slack
maxRedirects Indicates the maximum number of times that a single HTTP request can redirect. The minimum value is 0 and the default value is 5. integer 0, 1, 2, 3, 4, 5
overallTimeoutMillis Indicates the maximum number of milliseconds to wait after which the HTTP request timeout. The minimum value is 0 milliseconds and the maximum value is 300000 milliseconds. The default timeout is 2000 milliseconds. integer 2000
socketTimeoutMillis Indicates the maximum number of milliseconds to wait to receive the response from the endpoint server. The minimum value is 0 milliseconds and the maximum value is 150000 milliseconds. The default timeout is 1000 milliseconds. integer 1000
connectionTimeoutMillis Indicates the maximum number of milliseconds to wait for the request to reach the endpoint server. The minimum value is 0 milliseconds and the maximum value is 150000 milliseconds. The default timeout is 1000 milliseconds. integer 1000
rawUrl Indicates the web hook URL of the endpoint where the HTTP request is made. string https://api.opsgenie.com/v2/alerts
requestType Indicates the method that is used for the HTTP request. The supported methods are GET, PUT, POST, DELETE, and PATCH. string GET
requestHeaders Indicates the information about the request context. It helps the server to provide the response accordingly. You can use the field to send authentication credentials or any other custom information. array "authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
customVariables Indicates the variables that are used to replace values in the URL path and payload when the HTTP request is sent. array "key": "ui", "value": "https://tenant-name.observe.appdynamics.com"
rawPayload Indicates the payload that is sent with the HTTP request to the endpoint. string {\"property\": \"property value\", \"entity\":\"${eventList[0].entity_id}\"}
formData Indicates the form type data that can be sent with the HTTP request. The form data consists of key/ value pairs representing form fields and their values. array "key": "entity", "value": "${eventList[0].entity_id}"
successCriteria Indicates the request sent to the endpoint is successful. It has an option to expect a payload from the request sent to the endpoint. array { "statusCode": 200 }, { "statusCode": 201, "expectPayload": true }
failureCriteria Indicates the request sent to the endpoint has failed. It has an option to expect a payload from the request sent to the endpoint. array { "statusCode": 500 }, { "statusCode": 400, "expectPayload": true }

Example

The HTTP action template for OpsGenie is as follows:

{
    "name": "OpsGenie HTTP Template",
    "tagName": "OpsGenie",
    "requestParameters": {
        "requestType": "POST",
        "rawUrl": "https://api.opsgenie.com/v2/alerts",
        "encodingType": "UTF-8"
    },
    "requestHeaders": [
        { "key": "Authorization", "value": "GenieKey ${apiKey}" }
    ],
    "requestPayload": {
        "contentType": "application/json",
        "rawPayload": "{\n  \"source\": \"AppDynamics Cloud\",\n  \"message\": \"${eventList[0].event_type} on ${eventList[0].config_name}\",\n  \"alias\": \"${eventList[0].violation_id}\",\n  \"description\": \"${eventList[0].event_type} on ${eventList[0].config_name}\",\n  \"entity\": \"${eventList[0].entity_type}:${eventList[0].entity_id}\",\n  #if( ${eventList[0].violation_severity} == \"CRITICAL\" )\n  \"priority\": \"P1\",\n  #elseif( ${eventList[0].violation_severity} == \"WARNING\"  )\n  \"priority\": \"P3\",\n  #else\n  \"priority\": \"P5\",\n  #end\n  \"details\": {\n    \"Event Name\": \"${eventList[0].event_type}\",\n    \"Event ID\": \"${eventList[0].event_id}\",\n    \"Entity Type\": \"${eventList[0].entity_type}\",\n    \"Event Time\": \"${eventList[0].event_time}\",\n    \"Entity ID\": \"${eventList[0].entity_id}\",\n    \"Link\": \"${appdURL}${eventList[0].entity_context_path}\"\n  }\n}",
        "encodingType": "UTF-8"
    },
    "customVariables": [
        { "key": "apiKey", "value": "" },
        { "key": "appdURL", "value": "" }
    ]
}