Skip to content

HTTP call (http)

Calls an HTTP API under an HTTP configuration: one GET, POST or PUT, with a templated path, templated headers and a templated JSON body. The call is always awaited: a 2xx response is a success, any other status (a redirect included, since redirects are never followed) or a transport error is an error. With a success condition (CEL), the call goes on waiting: a GET is polled on its own URL, a POST or PUT on its status URL, until the success or the failure condition holds, or the timeout expires.

Note

This channel does not use the custom template.

Configuration

  • body - JSON - optional - JSON body of the call, for POST and PUT only, sent as application/json. Its string values are templated; numbers and booleans are sent as they are. No body is sent when it is absent.

  • config - String - required - Name of the HTTP configuration: its base URL and its authentication.

  • failureCondition - String - optional - CEL condition on a response, telling that the call failed, for example response.body.status == 'FAILED'. Requires a success condition. When both hold, the call fails.

  • headers - List - required - Extra headers of the call. Their values are templated. Authorization, and any header set by the HTTP configuration, are refused.

    • name - String - required - Name of the header

    • value - String - required - Value of the header. Templated.

  • intervalSeconds - Int - required - Interval between two polls, in seconds. At least 5.

  • method - GET, POST, PUT - required - Verb of the call: GET, POST or PUT.

  • path - String - required - Path of the call, with an optional query, appended to the base URL of the HTTP configuration. Templated. After templating, it must stay under the base URL: an absolute URL, or a . or .. segment, is refused.

  • statusUrl - String - optional - CEL expression evaluated on the initial response of a POST or PUT, giving the path to poll with GET, for example response.headers['location'] or '/deployments/' + response.body.id. It is resolved under the base URL of the HTTP configuration, like the path. Requires a success condition. Without it, the conditions of a POST or PUT are evaluated on the initial response only.

  • successCondition - String - optional - CEL condition on a response, telling that the call succeeded, for example response.body.status == 'SUCCEEDED'. It sees response.status, response.headers (by lowercase name, first value), response.body (parsed JSON) and attempt. Without it, any 2xx response is a success. With it, the call is awaited: a GET is polled on its own URL, a POST or PUT on its status URL, until a condition holds or the timeout expires.

  • timeoutSeconds - Int - required - Maximum time to wait for a condition to hold, in seconds, capped by the maximum timeout of the HTTP notifications settings. At least the interval.

Output

  • attempts - Int - required - Number of requests sent: the initial one, and the polls

  • body - JSON - optional - Body of the response: parsed when it is JSON, as text otherwise. It is read up to the maximum response size of the HTTP notifications settings.

  • condition - SUCCESS, FAILURE, PENDING - optional - Outcome of the conditions on the last response: SUCCESS, FAILURE or PENDING. Absent when there is no condition, or when they could not be evaluated.

  • headers - Map - required - Headers of the response, by lowercase name, repeated values joined by a comma. Authorization, Set-Cookie and the headers set by the HTTP configuration are left out.

  • method - GET, POST, PUT - required - Verb of the call

  • status - Int - optional - Status code of the response, absent when no response was received

  • statusUrl - String - optional - URL which is polled, when the call waits for a condition: the URL of a GET, or the status URL of a POST or PUT

  • truncated - Boolean - required - True when the body of the response was longer than the maximum response size, and was cut

  • url - String - required - URL which was called, after templating

Example:

channel: http
channelConfig:
  config: deployments
  method: POST
  path: /deployments?project=${project}
  headers:
    - name: X-Request-Id
      value: "${build}"
  body:
    version: "${build}"
    environment: production
    replicas: 3
  successCondition: "response.body.status == 'SUCCEEDED'"
  failureCondition: "response.body.status == 'FAILED'"
  statusUrl: "response.headers['location']"
  intervalSeconds: 10
  timeoutSeconds: 600