I have an API that will have multiple different calls, but I need them to all be called sequentially

Hi everyone,

I’m building an app that aims to pull the advertising spend from different Facebook ad accounts, and list them all in a table. I’m using the Facebook Marketing API, and Bubble’s API Connector plugin. The facebook ad accounts are from different Facebook profiles (so I have multiple access tokens, multiple ad account IDs, etc)

This is how I have structured the API calls in the connector plugin (I’ve blocked out the ad account-identifying information):

Notice there is a call for Account 1, and Account 2. The total number of accounts’ API calls that will exist in the app is dynamic. Today there are 2, tomorrow there may be 4, next month there may be 8.

The only data I am pulling from these calls is the total dollar spend on the ad accounts for a particular date range (that I will choose using date-picker elements in Bubble).

I’m looking for a way to tell Bubble to automatically:

  1. Check to see how many API calls I have within the ‘Facebook Accounts’ API that I made
  2. Perform the API calls one by one, grab the spend for each account, and list them in a repeating group.

I know that, each time I add in a new API call for a new FB account inside the api connector plugin, then I can go and create a new action within my app’s workflow to manually get the data. But I don’t want to create 100 actions if I have 100 ad accounts’ spends to pull. I am looking for a way to create a single action that will check how many ad accounts’ API calls I have added to the plugin, and then run through them one by one.

Any help is appreciated

I would move the tokens etc to their own table …

Untick the “private” box on the parameters.

Then in your RG you can search for the “Accounts” in the new table. Then in each row you can call the API with dynamic tokens to pull back the spend.

Hope that helps.

Thank you I’ll try this out!