Skip to content
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

Pagination: use HTTP headers #11

Open
alekitto opened this issue Jan 16, 2020 · 2 comments
Open

Pagination: use HTTP headers #11

alekitto opened this issue Jan 16, 2020 · 2 comments

Comments

@alekitto
Copy link
Member

HTTP headers could be used for pagination (and ordering) in a more RESTful way.

Standard Accept-Ranges and Range HTTP header could be used to paginate lists.
My proposal is to adopt two custom units for ranges:

  • units or resources for limit-offset pagination
  • after or continue for passing a continuation token

A custom X-Order header could be introduced to set the list order, allowing an order field to be freely filtered without name collisions. In this case the header should have the following format:

  X-Order: token; ASC | DESC
@massimilianobraglia
Copy link
Member

Indeed, HTTP headers could be used. Can you point out the Accept-Ranges and Range in the standard?
Agree also for the X-Order header. Much better probably than specify an OrderColumn that overrides the order name (or using another one)

@alekitto
Copy link
Member Author

Range: https://tools.ietf.org/html/rfc7233#section-3.1 (here's the MDN article: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range)

Accept-Ranges: https://tools.ietf.org/html/rfc7233#section-2.3 (MDN: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges)

As you can see in the IANA HTTP Range Unit Registry only bytes and none are registered units. All others range specification are usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants