[rest-practices] Pagination API

Bill Burke bburke at redhat.com
Mon Jul 26 15:41:31 UTC 2010


Create a new representation for complex queries maybe?  And use POST 
instead?  Downside is you lose HTTP caching + GET.

Kent Watsen wrote:
> I agree that the paging api could use simple query parameters, but multi-column sorting (example sent previously), field selections (a la LinkedIn API), and ad hoc filter expressions all require parentheses.  Once the infrastructure has been developed to support parentheses, using them for paging seems better
> 
> K.
> 
> 
> -----Original Message-----
> From: Bill Burke [mailto:bburke at redhat.com] 
> Sent: Monday, July 26, 2010 9:58 AM
> To: David Lutterkort
> Cc: Kent Watsen; rest-practices
> Subject: Re: [rest-practices] Pagination API
> 
> I agree namespace it if you have to.
> 
> paging.limit paging.start
> 
> David Lutterkort wrote:
>> 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
>>
>>
>> _______________________________________________
>> rest-practices mailing list
>> rest-practices at redhat.com
>> https://www.redhat.com/mailman/listinfo/rest-practices
> 

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com




More information about the rest-practices mailing list