Having trouble calling a REST API with the IDs of all the selected rows of a table

Currently I am trying to call a REST API that accepts an integer ID and will update the relevant table entry with an existing config in the database. I am trying to call this API with all IDs from the selected rows/entries of a table. How can I loop through this array of IDs in the JSON Body of my query? I am following this resource (https://docs.retool.com/docs/scripting-retool) but it does not seem possible. Any tips/insights would be greatly appreciated, thanks so much.

Hey @EL3895! Would something like this work for you? http://community.retool.com/t/how-to-loop-through-an-array-and-hit-an-api-for-each-value-in-a-column/4291/2

Let me know if you have any questions at all :blush:


Hey @victoria ! Thanks so much for your help -- it worked! I had an even bigger query written, turns out I just needed to correctly link the additionalScope variable to the value of the JSON body. Appreciate it!

1 Like

Hey @EL3895! So happy to hear that :blush: Let us know if you run into any other issues

Actually I do have another question @victoria ! How can I get data to persist in the table after pressing submit? Currently the table auto clears after I press submit and run the query

Hmm! So in your table, what data is it using? Something like {{ query1.data }} ?

Could you check out that value in the left panel to see if the data property actually contains data?