Automatic page iteration - Node client



I have a a somewhat obvious question regarding pagination and automatic page iteration. Reading the docs for Asana Node Client it seems that using .fetch(number) will automatically iterate over multiple pages and will fetch as many records as I want. So by that logic if there are 1500 projects in my team, I can say .fetch(1500) and it will be returned no problem? It will count as one API request and will not be limited in any way because pagination happens in the background?

Thanks for the help! I just want to make sure I am setting up my API Server as future proof as I can, anticipating increased number of records.


Most of what you gathered is true - that is, you will be handed 1500 tasks in the callback function. However,

It will count as one API request and will not be limited in any way

is not true; rather, the Node client library is paginating over the data client side by making multiple requests and appending them to the list, and then it hands them on to your callback function after all pages are fetched. The default page size that’s configured for our client library is 50 items (this is configurable, but note the maximum/enforced limit for page size in our API is 100) so this would create 1500 / 50 = 30 API requests to get this much data.



Super helpful and insightful! Thank you Matt.