Might be overthinking this but what’s best practise for implementing pagination in your api calls?
What are you looking to achieve?
I’m making a GET api call to get a list of customers from a ERP. By default it returns chunks of 50 and only the first 50. I need the glide call api to check for next page and return and repeat until all data is collected.
One option is of course to do this in a make scenario but would prefer to do it straight of from glide to erp api.
One real life use case I’d like to achieve is utlizing a recipe builder in the erp. This means selecting from about 10k of products in erp db to create recipies for in this case food menu items in a restaurant.
This sort of iteration is not possible (yet) with the Call API action.
You would need to use something external to Glide such as Make or Apps Script.
I imagine those API calls would return a “next page ID” or something like that, then you keep iterating until the next page ID is empty.
In Make, this would mean something like:
-
Set a Repeater module to repeat a number of times that is likely to cross the pages count.
-
Add a get variable module. Get the “next page ID” variable (to be mentioned later).
-
Fetch from the ERP, steps after the first one would have to include the pagination ID.
-
Check if the current GET call returns a next page ID. If yes, use a set variable module to set that page ID to the “next page ID” variable (so you can get it for the next iteration).
-
If no next page ID is presented, stop the whole process. Now I don’t know if we have a module to do that, maybe a HTTP module to force an error?