Invoke HTTP API

Creates a HTTP request to any HTTP based resource

The Invoke HTTP API Node can be used to make any type of HTTP request. Sanbox will generate Prefabs for this Node when you import an OpenAPI specification.

Usage

Configuring a Invoke HTTP API Node
  • Http Method: Method used to make the request.

  • Path: Path/endpoint used to make the request. Paths can have templates for Path Variables, as seen in the example above.

  • Authorization Strategy: Use this field to set a strategy used to authenticate/authorize when calling the Http endpoint. You can configure these in the Project Editor.

  • Headers: Headers to send with the request.

  • Body: Body to send with the request.

  • Expected Responses: Responses to handle for a response after making request.

Setting a Path and Path Variables

A path is required to initiate the request. Your path can contain Path Variables, which are entered between the { and } characters. In the above example, we are setting the count variable to the productsNeeded property of the object to be inputted into our node. Consequently, when this Node runs with the following object as input:

{
"productsNeeded": 12,
"someProperty": "randomStuff",
"someNumber": 1
}

It will call:

https://example.com/getProducts?count=12

The Path Variables are not be confused with Workflow Variables. Path Variables are in context of just the HTTP API Node you're configuring. However, you can use a Workflow Variable by specifying a Path Variable, then using the conduit for the Path Variable to use a Workflow Variable.

Handling Authentication & Authorization

Sanbox supports a few standard HTTP authentication methodologies out-of-the-box that can be configured in the Project Editor. To use an authentication strategy you've predefined, choose the strategy type in the Strategy Type drop down, then supply the variable created in the Project Editor for that strategy.

Headers

Headers can be added to your request. Clicking the plus (+) button will add a header record.

Body

You can tack on a body to your request. Sanbox will take your JSON object and properly encode it for the specific body type, whether it be form-data, url-encoded, or just raw content.

If you choose a content body and don't specify a Content-Type header, Sanbox will add one for you. It will choose application/octet-stream if you pass just raw bytes, and application/json otherwise.

You can also specify a Model to be used for the Body. The Model is just used for organization and consistency purposes unless you check Validate Model, which will cause Sanbox to validate your body against the Model before sending the request. An error is thrown if the Model is invalid in this case.

Expected Responses

For each button you click in this area, an output will be generated for your Invoke HTTP API Node for you to create a continuation for a specified status code. For all other status codes you are not expecting, an output called default is fired.

For each status code configured, you can choose a Model to describe the data that comes back in the response body. This model will not be validated against the response body unless you check Validate Response Model.

By default, the Invoke HTTP API Node just outputs the body that came back from the response. If you wish to have a larger object with properties pertaining to what status code, headers, and other information came back in the response, you can check Expounded Output.