-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API listing responses don't include counts or paging information #21
Comments
This is releated to #31, I think that some work on counting and paging would be valuable in 1.3/ |
Current BehaviourOur existing listing endpoints (GET /{entity-name}) already accept MySQL style "offset" and "limit" parameters. The documentation of default behaviour is not entirely clear, as they both list "0" as a default value, but what happens in the Preservica implementation (and I suspect any sane implementation) is that if they are not provided explicitly, the offset is interpreted as "0" and the limit as "unlimited". Currently, if you wanted paging behaviour, you would specify for example: offset 0, limit 10 for your first query, then offset 10, limit 10 for your second, and so on until the query returns fewer than 10 items. At that point, you can assume you have reached the end of the list. Our existing listing endpoints also specify a return object that is not specified in the domain model, but which consists of a single property "{entityNamePluralised}", which contains a list of entities. This object feels like a natural holder for version information as well as count/paging information. Proposal
Example return object:
ImplicationsAlthough not a documented requirement, sensible paging requires that the list of objects be returned in a consistent, predictable order. This can be implementation specific. An "orderBy" parameter to let clients determine the order they wish to receive the results in is a separate enhancement. The response will always include the nextPage information, it is a client implementation detail to determine when it has received the last page of results (i.e., when the returnedResults is less than the limit). Outstanding Questions
|
As a user of the API listing endpoints I want to have some paging information, including how many entities in total match my request, how many entities are in this response, where I am in the paging or how the next equivalent page of results is requested.
The text was updated successfully, but these errors were encountered: