Help with Pagination on API

Having a hard time figuring out the pagination on this one. The api call will output a JSON file that contains the total items being filtered (“filtered”: 879,). I have the initial offset set to “0” and the limit set to 10, the next run, the offset should be set to 10, and the one after 20… This should run until it matches the total from filtered.

Thanks in advance, as always!

Hi @madhatter349, looking at your existing logic you probably want to multiply your limit value with the current $runIndex (from this list). So when it first runs, the your HTTP Request node would use an offset of 0, on the second run it would be 10, then 20, etc… Use an IF node to exit the looping once you’ve reached the limit, like so:

You’ll need to adjust the example above since I couldn’t actually test it without valid credentials for your database or API. But the basic idea should still work. Hope this helps :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.