[rest-practices] Pagination API
David Lutterkort
lutter at redhat.com
Fri Jul 23 19:23:09 UTC 2010
On Thu, 2010-07-22 at 13:08 -0700, Kent Watsen wrote:
> ABNF Syntax:
>
> "paging=(" ["start=" 1*DIGIT ","] "limit=" 1*DIGIT ")"
>
> Notes:
>
> * Returns at most "limit" items, starting with the "start" item in the collection
> * "0" is the default <start> value used when none is specified
> * Paging is over live data; elements may shift over the course of multiple requests
>
> Examples:
>
> * paging=(limit=25)
> * paging=(start=0,limit=25)
What's the reason for having a special format within the query
parameter ? That forces the client to do extra work if they want to jump
to item 42 (rather than just tacking '?start=42&limit=25' at the end of
the URL)
I would just go with parameters 'page', 'limit', and 'order' (addressing
per-page, rather than per-item, seems simpler to me, with counting pages
from 1), i.e. something like
'/index?page=5&limit=10&order=name,modified_at.desc,color.asc'
David
More information about the rest-practices
mailing list