Use a URL from the DB to dynamically populate a REST API query

Goal: I have a "recordings" table in my Retool DB with "download_url" and "download_url_segment" columns (the download_url includes the base URL and the download_url_segment is just the portion that is different for each row). I want to:

  1. Use either of the two url columns to dynamically populate the URL of a REST API GET call.
  2. Return the data from the GET call.
  3. Loop through all the rows, doing a separate API call to each download_url.

Mainly I am just having a hard time figuring out how to dynamically populate the URL of a REST API call since resource queries require absolute URLs.

Steps: I have a DB query that returns the download_urls/download_url_segments as an array, and a REST API resource configured with the base URL, but I don't know what to do from that point.

This seems like it should be relatively straight forward, but I can't figure it out! Any help would be greatly appreciated!

You could use a workflow with a loop block and insert the values into the URL using {{mydata}}.

What do you plan to do with the API results after?
Is this for an app or a workflow?

Example

@dfresh527,
In addition to the workflow method that @ferret141 describes above, in your app, you can also use additionalScope to pass variables to an api resource. So in a js code block, you would call your api and pass in additional scope like this:

getUser.trigger(
{
   additionalScope: {
       index: select1.value,
       otherKey: select2.value
   }
 }
)

And then in your api resource, you would use the variables like this:

You could write a for loop in a js block to do this for each item in your array.

That worked! :raised_hands: Thank you!