HTTP Task
HTTP task is a system task that enables a workflow to interact with external applications, systems, and processes via HTTPS.
There are several tabs available where you can configure a HTTP task:
- General tab
- Input Parameters tab
- Configuration tab
- Retry tab
- Routing tab
The configuration of the General, Input Parameters, and Routing tabs is similar to that of a user task. We discuss only the Configuration and Retry tabs here.
Configuration tab
From the Configuration tab, set up the following fields:
Field |
Required |
Description |
---|---|---|
Credentials |
No |
The saved credentials to use for the target authenticated HTTP request. |
HTTP request |
Yes |
A configuration for HTTP request represented by a JSON Object. |
Connection time out in seconds |
No |
The HTTP connection time out in seconds. Minimum: 1. Default: 5. |
Read time out in seconds |
No |
The HTTP read time out in seconds. Minimum: 1. Default: 10. |
HTTP request field top-level fields
Field |
Type |
Required |
Description |
---|---|---|---|
|
String |
Yes |
Represents the URL to which the HTTP request should be sent. |
|
String |
Yes |
Represents the HTTP method to be used for the request. Supported Methods: GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS |
|
JSON Object |
No |
Represents the HTTP headers to be included in the request. Each field within the headers object corresponds to a specific HTTP header key-value pair. |
|
Object |
No |
Represents the body of the HTTP request. This field is typically used for sending data in POST, PUT, PATCH, or other request methods that support a request body. |
Note:
-
The URL, header values, and body of the HTTP request can reference task input parameters using JSONPath expressions enclosed within
${}
placeholders. -
To escape a JSONPath expression, prefix it with an extra
$
character, e.g.,$${}
. See JSONPath for more information about JSONPath. -
Alternatively, JSONata expressions can be used instead of JSONPath by prefixing the expression with
jsonata:
within${}
placeholders. See JSONata for more information about JSONata.
Here is an example HTTP request to SimWorkflow API to retrieve a list of workflow definitions:
{
"url": "https://api.simworkflow.com/workflow-definitions",
"method": "GET",
"headers": {
"Accept": "application/json"
},
"body": null
}
The Test request button allows you to test the HTTP request configuration with the task input parameters JSON data.
Response for HTTP request
The response for the HTTP request is a JSON Object with the following fields:
Field |
Type |
Description |
---|---|---|
|
Map[String, Any] |
The HTTP response headers |
|
Integer |
|
|
String |
HTTP response status code's reason phrase |
|
Any |
The body containing the response if one is present |
Retry tab
Task can encounter runtime errors. Errors can arise because of workflow definition issues, task failures or because of transient issues, such as network partition events.
When a task reports an error, the default course of action is to fail the whole workflow. Or the task can be retried, usually at increasing time intervals.
From the Retry tab, setup the following fields:
Field |
Required |
Description |
---|---|---|
No retry and fail the whole workflow |
Yes |
No retry and fail the whole workflow when errors occur. |
Retry the task when errors occur |
Retry the task an error occurs. |
|
Interval in seconds |
No |
The number of seconds before the first retry attempt. Minimum: 1. Default: 1. |
Max attempts |
No |
The maximum number of retry attempts. Minimum: 0. Default: 3. When this is set to 0, errors should never be retried. |
Backoff rate |
No |
The multiplier by which the retry interval increases with each attempt. Minimum: 1.0. Default: 1.0. |
An example of a retry which will make 2 retry attempts after waits of 3 and 4.5 seconds:
-
Interval in seconds: 3
-
Max attempts: 2
-
Backoff rate: 1.5