The HTTP Client connector provides a way to manually make REST based requests to a specified URL. You can use the HTTP client to make calls to any REST API; it's useful for making calls to services that don't yet have a tray connector.
Our HTTP Client connector intelligently handles data to make things as simple, reliable and consistent as possible. Here's some of the measures we take:
Content-Typeheader is automatically set depending on the
bodyprovided, with application/x-www-form-urlencoded being set if none is selected. Additionally, the
Content-Typeof the request can be set/overwritten by explicitly specifying it in the
Acceptheader is fixed to application/json, with a few exceptions. If the
bodyis set to none, or the automatically detected
Content-Type(dependent on the
body) is either text/plain or application/x-www-form-urlencoded, then
Acceptis not set. Additionally, the
Acceptvalue of the request can be set/overwritten by explicitly specifying it in the
|GET||Send a GET request.|
|POST||Send a POST request.|
|PUT||Send a PUT request.|
|PATCH||Send a PATCH request.|
|DELETE||Send a DELETE request.|
|HEAD||Send a HEAD request.|
The HTTP Client connector allows basic authentication. It does not yet support OAuth. To add a new authentication (for example a token) click Add Authentication then choose a name for your auth token. Enter your token. This auth token can then be used in your API call (for example, as a parameter) by including the path "$.auth.token_name". Note: different APIs need to be authenticated in different ways, for example via:
- Query parameters
- Basic authentication (username & password)
- Access tokens (OAuth)
To view settings related to the last two, open up the "advanced settings" for the properties and you'll see the following:
A note on OAuth - this is only supported for services that Tray already supports.
The best way to check that everything is running properly is to use a manual trigger to call your API and inspect the logs to see what messages are being passed back and forth. We also recommend using a service like postman for exploring APIs.