Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Trying to understand pagination on Web API

$
0
0

I have 5000+ account records to work with. I'm trying to create a nice paginated list of these accounts.

I've seen the documentation here: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/query-data-web-api but it seems a little limited.

I can set the number of items per page easily enough with the header Prefer: odata.maxpagesize=50

This provides then a @odata.nextLink to get the next page. Seems simple enough.

What if I want to skip ahead to page 5?

Looking at the query string in nextLink, I see it has the page number in a cookie value.

I've found I can do a request to accounts?$select=name&$skiptoken=<cookie pagenumber="5"> and this seems to work.

But is this right? It feels dirty, is there a better way?

Also, there's a few more basic details missing, like total number of pages. I can get a count of total accounts (and calculate the total number of pages) with $count=true but this is limited to 5000, so it won't be accurate. How would I skip to the last page in this scenario?

Any help in this regard would be greatly appreciated Am I on the right track? Is there some documentation somewhere I'm missing?


Viewing all articles
Browse latest Browse all 79901


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>