Search code examples
restaxaptadynamics-365-operations

How to get next page of records over 10,000 in Dynamics 365 REST API


I am able to query Dynamics 365 API

https://<COMPANY-NAME>.dynamics.com/data/Ledgers?$filter=AccountingDate+ge+{0}+and+AccountingDate+lt+{1}

Where {0} and {1} are dates (i.e. 2019-03-15)

The problem is that Dynamic 365 API has a limit of 10,000 records returned and there are more than 10,000 records. Is there a parameter to add to the URI that enables me to obtain the next "batch" of records so I can obtain all of them?

I have search with my Google-Fu but I must still be at the grasshopper level because I cannot find anything in Microsoft's Dynamics 365 API reference or on the web that mentions it. I am looking for a REST like solution so I can use this cross platform and not have to depend on an SDK.


Solution

  • This referred to as Paging, and is common on most REST APIs

    Microsoft Dynamics 365 Web API follows the odata standard for paging, and when there are more pages of data to retrieve the @odata.nextlink property is included in the response which you can use to create another request to get the next page of information, this can be repeated until the @odata.nextlink is null or missing to get to the end of the dataset.

    There is more detailed information about API limits in the Microsoft docs under the Limit, as well as specific samples for Paging for the Dynamics 365 Web API.