Recursive Api call

Hello everyone,

I’m new to Bubble and I need some assistance with an API issue. I’ve been receiving data from an API, but the problem is that it only returns a maximum of 1000 items per request. However, it also provides a “nextTokenPage” which allows me to make a new request by passing that token.

I would like to know how to make these calls recursively on Bubble, as long as I have a “next” value in my response. I would greatly appreciate it if you could suggest a method to execute this action recursively.

Thank you in advance for your help!

Other informations

image

Here’s what this should look like in my opinion.

Define the API workflow to take in a variable called nextPageToken (set the type to the same as whatever the API call is returning as the nextPageToken)

Then inside the API workflow it should:

  • Call the API
  • Save data to DB
  • Schedule ITSELF again with the nextPageToken from the API response IF it’s not empty.


Hope this helps

Also:
Your nextPageToken should be an optional parameter, so you can start the whole workflow.

thanks a lot chiprana i’m trying this rightnow

it’s work fine
Thanks you :smiley:

1 Like