Using the HTTP Command

Updated 2 weeks 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.

You can then publish these are output variables using the Publish output in the context settings. Whatever is configured in Process Additional Variables can be made available in the context defined in Publish output in the context.

In Name, enter a name for the variable. In Expression, enter an expression that obtains some value. 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.

Publish output in the context

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

in Publish Variable Name, enter a unique name to define the output context. You will use this name to reference the variable elsewhere.

For example, if the name of a variable in Process Additional Variables is name the Publish Variable Name is httpoutput, you would reference it with ${}.

Here is the HTTP step:

And here is a Shell Script step referencing the published variable using ${}:

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.

Delegate Selectors

You can use Selectors to select which Harness Delegates to use when executing the HTTP step. Enter the Selectors of the Delegates you want to use.

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 Selector.

Harness will use Delegates matching the Selectors you select.

If you use one Selector, Harness will use any Delegate that has that Selector.

If you select two Selectors, a Delegate must have both Selectors to be selected. That Delegate might also have other Selectors, but it must have the two you selected.

Use Delegate Proxy

Select this option to explicitly use the delegate proxy settings. For details, see Delegate Proxy Settings.

  • If the Delegate is not using any proxy, selecting this option does not enable the proxy settings.
  • If you have specified an URL that is set up to bypass proxy settings on the Delegate, then it throws an error.

Next Steps

How did we do?