Skip to main content

Loop

Sometimes you have to make similar requests many times.

Let's say there is an array of the order IDs: order = [23432, 42342, 23423, 423423]

You have to get data for each order by hitting the same API. e.g. {{host}}/demo/api/v1/{{order_id}}

To make this happen, we can use the loop feature.

Open the "decision node" where you use the API end-point.

Down below enable "Is Loop Request?"

In the Loop Data field, write the variable of an array ($.order).

img.png

In every iteration, the variable $.LOOP_ITEM is updated in the context to reflect the current value from the loop, so you would need to set the {{order_id}} parameter like so:

img_11.png

If you don't have a ready array, then you can create it in JS Calculator.