Using the HTTP Command

Updated 5 hours ago by Michael Cretzman

You can use the HTTP command to run HTTP methods containing URLs, methods, headers, assertions, and variables. You use the HTTP template in a Harness Workflow.

Create HTTP Command

  1. In your Workflow, click Add Step. The Add Step dialog appears.
  2. To create a new HTTP command, click HTTP. To use an existing HTTP command, select a Template Library and link the HTTP command template to your Workflow. For this example, we will create a new HTTP command.
    The HTTP settings appear.

The following table describes the HTTP command options.




Enter the URL for the HTTP call.


Select the HTTP method.


Enter the media type for the message. For example, if you are using the GET method, the header is used to specify the GET response body message type Harness will check, such as content-type: application/json.

For multiple header entries, separate the headers with commas:

Content-Type: application/json, Cache-Control: no-cache


Enter the message body (if any) of the HTTP message.


The assertion is used to validate the incoming response. For example, if you wanted to check the health of an HTTP connection, you could use the assertion ${httpResponseCode}==200.

To see the available expressions, simply enter ${ in the Assertions field. The HTTP expressions are described in the HTTP section of Variables and Expressions in Harness.

You can also use JSON and XML functors as described in JSON and XML Functors. For example:"status", ${httpResponseBody}) == "success"


Enter a value, in seconds, for how long Harness should wait for a response from the server you specified in URL.

Process Additional Variables

Create variables using built-in Harness expressions. In Name, enter a name for the variable. In Expression, enter an expression that obtains some value from the HTTP response. Harness supports these functors and methods:

  • JSON Path:
    • select(). Example: ${"path-in-response", httpResponseBody)}
    • object(). Example: ${json.object(httpResponseBody).item}
    • list(). Example: {json.list(\"\", httpResponseBody).get(2).isbn}
  • XPath:
    • select(). Example: ${"/bookstore/book[1]/title", httpResponseBody)}

For details, see JSON and XML Functors.


You can use Tags to select which Harness Delegates to use when executing the HTTP step. Enter the Tags of the Delegates you want to use. For example:

You can also use Harness variable expressions. For example, if you have a Workflow variables named delegate, you can enter $(workflow.variables.delegate). When you deploy the Workflow, you can provide a value for the variable that matches a Delegate Tag.

Publish output in the context

Select this option to create a variable containing the content of the HTTP response, or the content of a variable specified in Process Additional Variables.

in Publish Variable Name, enter a unique name for the output variable. You will use this name to reference the variable elsewhere. For example, if the Publish Variable Name is region, you would reference it with ${context.region}.

If reference a variable named FIELD in Process Additional Variables, you would use ${region.FIELD}.

In Scope, select PipelineWorkflow, or Phase. The output variable are available within the scope you set here. The scope you select is useful for preventing variable name conflicts. You might use a Workflow with published variables in multiple pipelines, so scoping the variable to Workflow will prevent conflicts with other Workflows in the Pipeline.

Next Steps

How did we do?