Create a LOOP to import and Post mulitple rows

Hi there, pretty new to ReTool and Javascript so I'm copy and pasting and guessing my way through things. At the moment I am stuck on process where I'm guessing a loop would be the answer.
What I'm trying to do is GET fare details (from a tour company api) and POST them to different API.
In this example case there are 2 types of fares, Adult and Child. I need to POST first for the Adult, then do it again for the Child.

This means I need the "Adult" label and "129" Price here:
image

to be inserted to the "fareName" and "rrp" here:

and then do it all again with the child label.

I've been trying to put this inbetween but must be missing something

I would be grateful for any help, thanks

When you use a loop block, you would want to do everything you are doing in query19 IN the loop block.

In this case, it seems like you should be choosing the WT Supplier API TEST 02 (rest api) resource to use in the loop rather than the Run JS Code option you have selected.

When you use the loop block in this way, you tie the values from your iterable query (Return_Rezdy_priceOptions) to the JSON body using {{value.label}} and {{value.price}} as the parameters.

1 Like