I have OData source, that implements $skip
and $top
parameters.
There are x number of entities that are returned. Say, I have only 250 entities. And then I try to do the paging like this:
https://example.com/EntitySet?$top=30&$skip=220
If my skip goes beyond the number of total entities, I eventually get timeout from service.
Is there a parameter or data, that would inform me that there are no more items? Is there something that can/should be implemented on OData side, that gets returned instead of timeout?
For OData 2.0 and OData 3.0 protocols:
You should use: $inlinecount=allpages
http://services.odata.org/OData/OData.svc/Products$inlinecount=allpages&$top=5&$format=json
Identifies the first 5 Product Entries and includes a count of the total number of Product Entries.
For OData 4.0, you can read the nextLink annotation embeded in the response. (See example here)
4.5.5 Annotation odata.nextLink The odata.nextLink annotation indicates that a response is only a subset of the requested collection of entities or collection of entity references. It contains a URL that allows retrieving the next subset of the requested collection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With