Query Next Page


I have an API that returns paginated results along with nextpage token. How do I execute subsequent API calls to get further results and aggregate as one single array for table.

PS. I cant have nextpage parameter for my first call so I will need 2 apis. first gets me results with a next page token and subsequent calls will have next page parameter.

I need this to run until we dont see a nextpage token.

Please help me how do I achieve this.

I tried something like this but it dint work

if(listTags.data.next != ''){
nextPageToken: (listTags.data.next).split("=")[1]

Hey there @Jerry111, we do have some support for cursor-based pagination built in to our tables, have you already taken a look at those docs?

The table pagination is great, but it would be awesome if this could be built directly into the query API to allow us to have the full result of paginated API queries - maybe with either a page limit or record limit field in the UI.

Ahh I see I may have misunderstood your question. You can access the results of a query in the JS that you trigger it from using async/await since query triggers always return promises. In your case you might try something like:

const maxPages = 50;
let apiCallData = await getallTags.trigger();
let i = 0;

while(apiCallData.next && i < maxPages){
  apiCallData = await getallTags.trigger({
    additionalScope: {
      nextPageToken: apiCallData.next.split("=")[1]
  /* accumulate your data here based on its structure */

Does that work?