HTTP task definition object
HTTP task (identified by "type": "Http"
) is used to:
-
Making calls to another service that exposes an API via HTTPS
-
Fetch any resource or data present on an endpoint
The HTTP task is moved to Completed
status once the remote service responds successfully.
Here is an example HTTP task to fetch a list of SimWorkflow workflow definitions:
"Fetch Workflow Definitions": {
"credentials": "CredentialsId",
"description": "Fetch a list of SimWorkflow workflow definitions",
"type": "Http",
"httpRequest": {
"url": "https://www.simworkflow.com/api/workflow-definitions",
"method": "GET",
"headers": {
"Accept": "application/json"
},
"body": null
},
"retry": {
"intervalSeconds": 1,
"maxAttempts": 3,
"backoffRate": 2.0
},
"end": true,
"connectionTimeoutSeconds": 10,
"readTimeoutSeconds": 10
}
The HTTP task has the following additional fields:
Field |
Type |
Required |
Description |
---|---|---|---|
|
Credentials Id |
No |
The saved credentials to use for the target authenticated HTTP request. |
|
JSON Object |
Yes |
A configuration for HTTP request represented by a JSON Object. |
|
JSON Object |
No |
The retry configuration to retry the HTTP task when encounter runtime errors. |
|
Integer |
No |
The HTTP connection time out in seconds. Minimum: 1. Default: 5. |
|
Integer |
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.
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 |
Response for HTTP request
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.
Field |
Type |
Required |
Description |
---|---|---|---|
|
Integer |
No |
The number of seconds before the first retry attempt. Minimum: 1. Default: 1. |
|
Integer |
No |
The maximum number of retry attempts. Minimum: 0. Default: 3. When this is set to 0, errors should never be retried. |
|
Double |
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