HTTP Request
The HTTP Request activity fetches information from an external data source such as a CRM using standard HTTP protocols.
Basic Auth and OAuth 2.0 attributes are supported for authenticated endpoints.
The following sections enable you to configure the HTTP Request activity:
General Settings
Parameter |
Description |
---|---|
Activity Label |
Enter a name for the HTTP Request activity. |
Activity Description |
(Optional) Enter a description for the activity. |
HTTP Request Settings
Parameter |
Description |
---|---|
Use Authenticated Endpoint |
Enables the ability to make an HTTP request to an authenticated endpoint. By default, this toggle button is on. |
Connector |
Choose the Connector from the drop-down list. The drop-down list displays the name of the Connectors configured in the Control Hub. The Connector provides a common location to store credentials for the service you want to access. For example, the Salesforce Connector validates and allows connectivity to the Salesforce account. This Connector can then be referenced from within the HTTP Request activity to make a request. This essentially creates the domain section of the URL. To configure a connector on Control Hub, see the Set Up Integration Connectors for Webex Contact Center article. |
Request Path |
Enter the request path for the HTTP request. This field displays when the Use Authenticated Endpoint toggle button is on. |
Request URL |
Defines the Request URL which spans both domain and request paths for unauthenticated endpoints. This field displays when the Use Authenticated Endpoint toggle button is off. |
Method Types: GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD |
Defines the HTTP request activity that supports the following popular methods:
|
Query Parameters |
Defines parameters that you pass as part of the HTTP Request. The web server provides these extra parameters to use, for example, to make a GET Request. In the Key‐Value columns, enter the key for the query and the associated value that needs to be sent with the query. The parameters are a list of key-value pairs that are separated with the ampersand (&) symbol. You can also use the variable values in the double curly braces syntax to pass variable values. For example, if you want to fetch the account balance of a customer based on the ANI, depending on the data store service APIs, the key and value can be: Key: Value: |
HTTP Request Headers |
Defines the HTTP headers that let the client pass additional information with an HTTP request. Request headers such as Accept, Accept‐*, or If‐* allow to perform conditional requests along with other headers such as Cookie and User‐Agent. For example, as part of a GET Request, use:
To add an HTTP Header, click Add New. This adds a row where you can enter the respective key‐value pairs. You can add as many HTTP headers as required as part of the HTTP Request. |
Content Type |
Specifies the expected content type of the request body. Application/ JSON, Form URL Encoded, TOML, XML, and YAML are supported content types. |
Request Body |
Specifies the data bytes transmitted in an HTTP transaction message, immediately following the headers if there are any. In certain types of HTTP Requests such as a POST or PUT request, you can send a request body that specifies the content to update at the target resource. |
Response Timeout |
Specifies the connection timeout for the HTTP Request. Default is set at 2000 milliseconds. |
Number of Retries |
Specifies the number of times the HTTP Request is attempted after failure. Retry for service is unavailable. This parameter is used if the status code is 5xx; for example, 500 or 501. |
Parse Settings
This section enables you to parse the response generated from the HTTP Request into different variables. This configuration is optional because not all HTTP Request scenarios require parsing.
Parameter |
Description |
---|---|
Content Type |
Specifies the expected content type of the response body. JSON, TOML, XML, and YAML are the supported content types. |
Output Variable |
Choose a variable to contain the data from a specific section of the HTTP Request response object. |
Path Expression |
Define the Path Expression for parsing the response object. Depending on the response object data structure and the reason to extract a subset of information, the Path Expression varies. Data is normalized to an object hierarchy before Path Expression execution, so JSONPath is used in the response object regardless of the configured Content Type. |
Output Variables
The HTTP Request returns the following output variables:
-
HTTPRequest1.httpStatusCode
: Returns the status code of the HTTP.These response codes are classified into five main categories:
-
Informational responses (100–199)
-
Successful responses (200–299)
-
Redirects (300–399)
-
Client errors (400–499)
-
Server errors (500–599)
-
-
HTTPRequest1.httpResponseBody
: Returns the response body for the HTTP Request. -
HTTPRequest1.httpResponseHeaders
: Returns the header information from the response.
Content Type Formats
The following examples describe sample input Content Type formats and the JSON response.
Content Type XML
Use this tool to convert XML into JSON format https://www.convertjson.com/xml-to-json.htm.
XML Input Format:
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Test application</body>
</note>
Data/JSON Normalized Response
{
"note": {
"to": "Tove",
"from": "Jani",
"heading": "Reminder",
"body": "Test application"
}
}
Example JSON Path Expression: Use $.note.from
to get the value as Jani
.
Content Type TOML
Use this tool to convert TOML to JSON format https://www.convertjson.com/toml-to-json.htm.
TOML Input Format:
title = "TOML Example"
[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00
Data/JSON Normalized Response
{
"title": "TOML Example",
"owner": {
"name": "Tom Preston-Werner",
"dob": "1979-05-27T15:32:00.000Z"
}
}
Example JSON Path Expression: Use $.owner.name
to get the value as ‘Tom Preston-Werner’
.
Content Type YAML
Use this tool to convert YAML to JSON format https://www.convertjson.com/yaml-to-json.htm.
YAML Input Format:
# An employee record
martin:
name: Martin D'vloper
job: Developer
skill: Elite
Data/JSON Normalized Response
{
"martin": {
"name": "Martin D'vloper",
"job": "Developer",
"skill": "Elite"
}
}
Example JSON Path Expression: Use $.martin.job
to get the value Developer
.
Content Type JSON
Use the JSON Expression Evaluator https://jsonpath.herokuapp.com/.
JSON Input Format:
{
"martin": {
"name": "Martin D'vloper",
"job": "Developer",
"skill": "Elite"
}
}
Data/JSON Normalized Response
{
"martin": {
"name": "Martin D'vloper",
"job": "Developer",
"skill": "Elite"
}
}
Example JSON Path Expression: Use $.martin.job
to get the value Developer
.