# How to aggregate the results of unknown number of requests (pagination)?

**URL:** <https://community.postman.com/t/how-to-aggregate-the-results-of-unknown-number-of-requests-pagination/80866>\
**Category:** Help Hub\
**Tags:** postman-flows\
**Created:** [June 5, 2025, 3:40am UTC](https://community.postman.com/t/how-to-aggregate-the-results-of-unknown-number-of-requests-pagination/80866 "2025-06-05T03:40:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joezhangmsn](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@joezhangmsn](https://community.postman.com/u/joezhangmsn)\
**Post date:** [June 5, 2025, 3:40am UTC](https://community.postman.com/t/how-to-aggregate-the-results-of-unknown-number-of-requests-pagination/80866/1 "2025-06-05T03:40:42Z")

</div>

I want to get some items via an API and do some filters and output the processed items. But the API returns 100 items every time and includes a field “nextLink” if there are more items.

I don’t know exactly how many times that I would call the API, so I tried to use “if block” instead of “repeat block” to do the loop, if the “variable block” can not be updated, then it can not be used for temporarily storing data, and seems “collect block” shoud be used together with looping blocks.

How can I aggregate the items returned by unknown number of requests?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/3/d/3d12dbac34bf97d75c506ba69483f0ed388f0e36.png)

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [June 5, 2025, 11:56pm UTC](https://community.postman.com/t/how-to-aggregate-the-results-of-unknown-number-of-requests-pagination/80866/2 "2025-06-05T23:56:46Z")

</div>

Hi @joezhangmsn

Try this strategy:

 ![Screenshot 2025-06-05 at 4.54.13 PM](https://us1.discourse-cdn.com/getpostman/original/3X/a/a/aa6c944b7cb421c3a059c68bf38550ffa7080973.png)

you’ll append the values each iteration so that it accumulates the final list which will output through the default port when nextLink is null. I don’t have your API to test the exact values but it should work as a template.

Let me know if this works for you 🙂

---

<div class="post-metadata">

**Author:** ![joezhangmsn](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@joezhangmsn](https://community.postman.com/u/joezhangmsn)\
**Post date:** [June 9, 2025, 3:11am UTC](https://community.postman.com/t/how-to-aggregate-the-results-of-unknown-number-of-requests-pagination/80866/3 "2025-06-09T03:11:39Z")

</div>

Hi Daniel,

Thanks a lot! This strategy works pretty well in my case!
