OData / WebApi

OData Web API: A server library built upon ODataLib and WebApi
https://docs.microsoft.com/odata
Other
855 stars 473 forks source link

Change Request: Allow $top to work with $skiptoken #2044

Open Grauenwolf opened 4 years ago

Grauenwolf commented 4 years ago

If the application needs a smaller page size then the server-defined default, one would expect to be able to provide a $top.

This scenario can occur if the API provides a large page size (e.g. 10,000) for bulk-loading the data, but a client also wants the ability to use the API for a UI scenario where small pages sizes (e.g 25) are more appropriate.

Currently that isn't supported. If there is a $top, then the client doesn't get a @odata.nextLink or the ability to provide a $skiptoken.


This could also eliminate the need to throw an exception when $top exceeds MaxTop. Instead it would return MaxTop rows with a $skiptoken to get the remainder.


Combining $skiptoken with $skip should not be supported. The client may provide one or the other, but not both.

KanishManuja-MS commented 4 years ago

@Grauenwolf The client can specify the max-pagesize in the preference header. That would be right way to override the page size defined by the odata service.

Grauenwolf commented 4 years ago

That needs to be called out in the documentation. Thus far I haven't seen anything about "preference header".