1st request: I need help getting an API to cycle through all available pages in a search request: (picture below)
As things stand, it just returns the first page of every search, but I need it to loop through all 11 pages and get all of the relevant ids from each item.
I have about 4-5 other requests for this project too, maybe 1.5-2hours of work via Zoom call.
2 Likes
If that’s xano, you could theoretically just return all rows at once. Not always the most efficient thing to do but depends on the size of the payload really.
The JSON response above is from RapidAPI. I get the same response in the API connector. I never heard of Xano, just took a look.
The issue is that the API will only return a maximum of 41 results per search.
So I need to create a function that recognizes the total pages (11 in this case) in the request and creates 10 more search requests to return all results from this search (while iterating the “page” parameter by +1 per search)
1 Like
Hey @jerseyikes,
from what I can tell there’s a couple standard solutions to this problem.
-
You can create a recursive loop using bubble’s custom events. However, this solution can pretty tough to maintain, especially since you have to wait some time in between each loop or you’re going to get rate limited by your API service provider. It’s a hairy way of doing things, in my view.
-
Creating a small custom plugin that loops over everything (either on the client side or the server side, whichever is necessary) and returns a result. While this requires code, the benefits are that you don’t have to mess with complicated bubble custom event logic and the performance of such a task will be significantly stronger.
I have a lot of experience building plugins, such as my public facing ones and I’ve also made a ton for private individuals.
Either way, I’m available to help / consult anytime. Send me a DM or email jonah@visioncode.io!
Best