Determine Pages on rest api request

I’m using the rest api.

Let’s say for example I’m quering Assets, and there are over 7000.

I know there is a parameter called ‘Page’ that can be supplied to the query. How does one know how many pages even exist? The reason I ask is because i want to add pagination to the bottom of my website but how do I know how many pages will exist? Does the initial query return information telling me how many pages are available?

Assuming I write my query in a way where I only collect the first 500. Does the data return to me some information letting me know there are 14 pages in total. As some users may want to jump to a specific page.

2 Likes

Hey John,

I’m looking into this. I’m hoping there’s a way to get what you’re asking for other than “query pages until there isn’t a next page”; I’ll let you know what I find out. Sorry for the radio silence!

2 Likes

I’m sad to say that there isn’t a way to get the paging info you’re after. Best I can offer you is to pull a reasonable number of records client-side and paginate on the data you’ve retrieved, instead of trying to keep a 1:1 between your site and the API. I’d also strongly suggest filtering as closely as possible in your query so that you’re not actually having to deal with 7k assets in a UI :wink:

1 Like

For sure :slight_smile: I appreciate you looking into this for me. Thank you. Sorry to hear there is no solution. But I agree with what you are saying.

1 Like