Question

ODATA

Hi Community,

 

https://academy.creatio.com/documents/technic-sdk/7-15/working-creatio-objects-over-odata-protocol-using-http-request

 

As per Academy,  "Records are returned by pages, 40 records per page. If a request is supposed to return more than 40 records, the reception of the next page must be ensured to reach the end of the current page.". How can I execute automatically and get the data from next page? Any idea? Thanks.  

 

Like 0

Like

4 comments

Hello Fulgen,

 

The $top query parameter can be used to indicate how many records to return. While 40 is the default, if you use a value larger than the total number of records, all records will be returned. For example: 

ContactCollection?$top=100000

Will return 100,000 contacts, or if less exist, all will be returned. Meaning if only 9000 contacts exist, all will be returned. 

 

You can also page the results, which is a better option in many/most cases. You can page the results by using $top along with $skip. For example, to page 100 records at a time, the first request would be:

ContactCollection?$top=100

Then the next request would be:

ContactCollection?$top=100&$skip=100

to get the next 100 records. Then the next would be:

ContactCollection?$top=100&$skip=200

You would keep incrementing the $skip by the number used for $top with each request to get the next page of results.

 

Ryan

Ryan Farley,

Neither DataService nor Odata will return over 20,000 records

Ryan Farley,



Hi Ryan,

 

After exscuting this code below



XDocument xmlDoc = XDocument.Load(dataResponse.GetResponseStream());



I noticed there is a descendant "link" which value of attribute "rel" is "next", is that the link for next page?

Kirill Krylov CPA,

Thanks Kirill, I figured there was a hard limit somewhere and 20,000 makes sense as I've seen that limit with reads in processes as well - never tried loading more than 20,000 via OData/DataService, not a good idea - Paging is always the way to go!

Show all comments