I am trying to update a variable in the API link to make multiple requests from a javascript query
Apologies I am new to retool. I created a variable in the preloaded JavaScript setting on the App called PID.
I then wrote a JS query that converts my string separated by commas into an array (of product IDs) then iterate through the list updating the variable and triggering the API.
Here is an example of a similar query that is triggering a getAllWhere query with additionalScope to determine the id dynamically via {{object_id}} (the same would apply for your restAPI query)
You can trigger this query from your Javascript query and push the result for each index into a result array - which you return in the end:
I find it helpful to return the output of the JS query in a jsonEditor component as it shows you which data type is returned, etc. Here is the output of the 2 record's names for ids 2 and 3: