I have to decide on a pagination strategy for returning results from a list. In particular, I am considering two approaches:
Example that lists results from 50 to 75:
Using query params: GET /items?start=50&limit=25
Pros
- Widely used
- Bookmarkable
Cons
- You will probably need to encode the URL ("&" character) to place it on XML response (complying with HATEOAS), and in that case the URL will not be very human friendly.
Embedded on the URL (page as a sub resource): GET /items/from-page-50-limited-to-25
Pros
- As human readable as needed (not required but seems like a good thing)
- No encoding necessary ever
Cons
- A little harder to build the URL client side
- Page is not really a sub resource of items, but a sub product of the listing items strategy
In your opinion, which would be the best REST practice approach?
Thanks in advance!