HTTP Client

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:

  • The Content-Type header is automatically set depending on the body provided, with application/x-www-form-urlencoded being set if none is selected. Additionally, the Content-Type of the request can be set/overwritten by explicitly specifying it in the header.
  • The Accept header is fixed to application/json, with a few exceptions. If the body is set to none, or the automatically detected Content-Type (dependent on the body) is either text/plain or application/x-www-form-urlencoded, then Accept is not set. Additionally, the Accept value of the request can be set/overwritten by explicitly specifying it in the header.

Configuration

Operation Description
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.

Authentication

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
  • Headers
  • 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.