[rest-practices] Pagination API

Sergey Beryozkin sberyozk at redhat.com
Mon Jul 26 10:04:17 UTC 2010


Hi

> > 
> > 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'

Grouping the related parameters may be the reason. In your example, it is likely the actual query 
may end up looking like this on the wire :

?limit=10&order=name&page=5

depending on how the actual client keeps the query options, not a big deal from the prcessing point of view, but
a bit confusing IMHO, given that we have 'system' (page, limit) and some application specific (order) queries intermixed.
I agree though that introducing a special format makes things a bit more complicated - personally I'd go for something similar to what you suggest but consider making it clear that page & limit are not the usual queries :

/index?_page=5&_limit=10&order=name

Sergey

> 
> David
> 
> 
> _______________________________________________
> rest-practices mailing list
> rest-practices at redhat.com
> https://www.redhat.com/mailman/listinfo/rest-practices




More information about the rest-practices mailing list