# Api Call with pagination

**URL:** <https://community.glideapps.com/t/api-call-with-pagination/74303>\
**Category:** Ask for Help\
**Tags:** data-sync, api\
**Created:** [June 21, 2024, 6:43pm UTC](https://community.glideapps.com/t/api-call-with-pagination/74303 "2024-06-21T18:43:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Lof](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_lof/32/48029_2.png) [@Daniel\_Lof](https://community.glideapps.com/u/Daniel_Lof)\
**Post date:** [June 21, 2024, 6:43pm UTC](https://community.glideapps.com/t/api-call-with-pagination/74303/1 "2024-06-21T18:43:06Z")

</div>

Might be overthinking this but what’s best practise for implementing pagination in your api calls?

🤔

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [June 22, 2024, 3:02am UTC](https://community.glideapps.com/t/api-call-with-pagination/74303/2 "2024-06-22T03:02:31Z")

</div>

What are you looking to achieve?

---

<div class="post-metadata">

**Author:** ![Daniel\_Lof](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_lof/32/48029_2.png) [@Daniel\_Lof](https://community.glideapps.com/u/Daniel_Lof)\
**Post date:** [June 22, 2024, 3:54am UTC](https://community.glideapps.com/t/api-call-with-pagination/74303/3 "2024-06-22T03:54:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Daniel\_Lof](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_lof/32/48029_2.png) [@Daniel\_Lof](https://community.glideapps.com/u/Daniel_Lof)\
**Post date:** [June 22, 2024, 3:57am UTC](https://community.glideapps.com/t/api-call-with-pagination/74303/4 "2024-06-22T03:57:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 22, 2024, 6:36am UTC](https://community.glideapps.com/t/api-call-with-pagination/74303/5 "2024-06-22T06:36:23Z")

</div>

> [@Daniel\_Lof](#):
>
> I need the glide call api to check for next page and return and repeat until all data is collected.

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.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 23, 2024, 12:41am UTC](https://community.glideapps.com/t/api-call-with-pagination/74303/6 "2024-06-23T00:41:30Z")

</div>

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?

[https://www.make.com/en/help/errors/throw](https://www.make.com/en/help/errors/throw)
