Widgets

Fan-out HTTP requests

Fan out requests give you the ability to execute multiple requests based on the JSON response of a previous request.

One common use case for this is where you have a Hateoas API and you want to execute a request for each of the links in the response.

Connector types

Input:

  • http_response
  • fan_out_response
  • json

Output:

  • fan_out_response

Creating a fan-out request

To create a fan-out request select the Fan out option in the Type dropdown.

Once you've done that a text field will appear where you can enter where to find the array in the input JSON.

All the other options are the same as a normal HTTP request.

Merging the results

You can merge the results of a fan out requests into a single JSON object with a template. In fact this is the only type of node you can chain to a fan out request.

Example template:

{{#each data}}
{{this.steps.[0].id}}, {{this.steps.[0].name}}, {{this.result.location}}, {{this.result.size}}
{{/each}}
  • #each is how you iterate over a list in Handlebars.
  • data is a list of the fanned out data. Each one can be thought of as a chain of requests.
  • this is the current chain. It will contain all the data from the requests in this chain.
  • this.steps.[0] is the first step in the fan out request. NOTE: If this step was a fan out request then this will only be part of the input used in this chain
  • this.result is the result of the last request in this chain
Previous
HTTP requests