Pagination question

Hello, I am trying to talk to the Cloudflare API for some dashboards, but I need to paginate the response and I'm getting a bit lost, even reading other forum posts.

Here is an example query, which is working but only grabbing the first page of results -

In the JSON of the response, there is a result_info.total_pages and a result_info.total_count which is the total number of rows. I'm just not sure how to use that info to gather all of the results, ideally into a table.

I may be wrong, but just trying to help.

  • add pagination add-on(image 1)
  • enable server-side pagination and add fields from your query(image 2)

You may need to add {{example_query.result_info.page}} as a page URL parameter. You'd then want to add a table action on page change that reruns the example_query so that the next page number is included.

Keep in my mind, I may be totally off-base - still figuring out the new table and the way it handles pagination.


Also keep in mind you can adjust per_page in your API call if you'd like - Cloudflare API Documentation

Thank you, this is super helpful.

Regarding the per_page, we actually have a client with several hundred zones in there, and I believe the maximum that will allow you to use is 50. Regardless, I'm also trying to wrap my head around just how to do this in general with tables.

You got me down a path that works though.

Here's what I set up for the server side pagination -

Robby's MacBook Pro 2023-07-19 at 21.02.41@2x

And then in the URL parameters I did this (seems the table pagination object starts at zero, thus the +1)

Ideally, I would love to just get all of the results in a query, and then put all of them in a table at once, but this seems to be working. I appreciate it!

1 Like

I believe you may be looking for Recursive API calls - these may help. Godspeed!

2 Likes