Skip to content

HTTP Task

"type" : "HTTP"

The HTTP task (HTTP) is useful for make calls to remote services exposed over HTTP/HTTPS. It supports various HTTP methods, headers, body content, and other configurations needed for interacting with APIs or remote services.

The data returned in the HTTP call can be referenced in subsequent tasks as inputs, enabling you to chain multiple tasks or HTTP calls to create complex flows without writing any additional code.

Task parameters

Use these parameters inside inputParameters in the HTTP task configuration.

Parameter Type Description Required / Optional
inputParameters.http_request HttpRequest JSON object containing the URI, method, and more. Required.
inputParameters.http_request.uri String The URI for the HTTP service. You can construct the URI using dynamic references, as shown in the GET example below. Required.
inputParameters.http_request.method String The HTTP method. Supported methods:
  • GET
  • PUT
  • POST
  • PATCH
  • DELETE
  • OPTIONS
  • HEAD
  • TRACE
Required.
inputParameters.http_request.accept String The accept header required by the server. The default value is application/json. Supported values include:
  • application/json
  • application/xml
  • application/pdf
  • application/octet-stream
  • application/x-www-form-urlencoded
  • text/plain
  • text/html
  • text/xml
  • image/jpeg
  • image/png
  • image/gif
Optional.
inputParameters.http_request.contentType String The content type for the server. The default value is application/json. Supported values include:
  • application/json
  • text/plain
  • text/html
Optional.
inputParameters.http_request.headers Map[String, Any] A map of additional HTTP headers to be sent along with the request.

Tip: If the remote address that you are connecting to is a secure location, add the Authorization header with Bearer <access_token> to headers.
Optional.
inputParameters.http_request.body Map[String, Any] The request body. Required for POST, PUT, or PATCH methods.
inputParameters.http_request.asyncComplete Boolean Whether the task is completed asynchronously. The default value is false.
  • false—Task status is set to COMPLETED upon successful execution.
  • true—Task status is kept as IN_PROGRESS until an external event (via Conductor or SQS or EventHandler) marks it as complete.

Tip: If the remote service sends an asynchronous event to signal the completion of the request, consider setting asyncComplete to true.
Optional.
inputParameters.http_request.connectionTimeOut Integer The connection timeout in milliseconds. The default is 100.

Set to 0 for no timeout.
Optional.
inputParameters.http_request.readTimeOut Integer Read timeout in milliseconds. The default is 150.

Set to 0 for no timeout.
Optional.

Configuration JSON

Here is the task configuration for an HTTP task.

{
  "name": "http",
  "taskReferenceName": "http_ref",
  "type": "HTTP",
  "inputParameters": {
    "http_request": {
      "uri": "https://orkes-api-tester.orkesconductor.com/api",
      "method": "POST",
      "accept": "application/json",
      "contentType": "application/json",
      "encode": true,
      "headers": {
        "header-1": "${workflow.input.header-1}"
      },
      "body": {
        "key": "value"
      }
    }
  }
}

Output

The HTTP task will return the following parameters.

Name Type Description
response Map[String, Any] The JSON body containing the request response, if available.
response.headers Map[String, Any] The response headers.
response.statusCode Integer The HTTP status code indicating the request outcome.
response.reasonPhrase String The reason phrase associated with the HTTP status code.
response.body Map[String, Any] The response body containing the data returned by the endpoint.

Execution

The HTTP task is moved to COMPLETED status once the remote service responds successfully.

If your HTTP tasks are not getting picked up, you might have too many HTTP tasks in the task queue. Consider using Isolation Groups to prioritize certain HTTP tasks over others.

Examples

Here are some examples for using the HTTP task.

GET Method

{
  "name": "Get Example",
  "taskReferenceName": "get_example",
  "inputParameters": {
    "http_request": {
      "uri": "https://jsonplaceholder.typicode.com/posts/${workflow.input.queryid}",
      "method": "GET"
    }
  },
  "type": "HTTP"
}

POST Method

{
  "name": "http_post_example",
  "taskReferenceName": "post_example",
  "inputParameters": {
    "http_request": {
      "uri": "https://jsonplaceholder.typicode.com/posts/",
      "method": "POST",
      "body": {
        "title": "${get_example.output.response.body.title}",
        "userId": "${get_example.output.response.body.userId}",
        "action": "doSomething"
      }
    }
  },
  "type": "HTTP"
}

PUT Method

{
  "name": "http_put_example",
  "taskReferenceName": "put_example",
  "inputParameters": {
    "http_request": {
      "uri": "https://jsonplaceholder.typicode.com/posts/1",
      "method": "PUT",
      "body": {
        "title": "${get_example.output.response.body.title}",
        "userId": "${get_example.output.response.body.userId}",
        "action": "doSomethingDifferent"
      }
    }
  },
  "type": "HTTP"
}

DELETE Method

{
  "name": "DELETE Example",
  "taskReferenceName": "delete_example",
  "inputParameters": {
    "http_request": {
      "uri": "https://jsonplaceholder.typicode.com/posts/1",
      "method": "DELETE"
    }
  },
  "type": "HTTP"
}