W3C home > Mailing lists > Public > ietf-http-wg@w3.org > July to September 2011

Re: API Pagination limit

From: Eric J. Bowman <eric@bisonsystems.net>
Date: Thu, 14 Jul 2011 10:23:58 -0600
To: Karl Dubost <karld@opera.com>
Cc: httpbis Group <ietf-http-wg@w3.org>, Jon Masse <jmasse@pheromone.ca>
Message-Id: <20110714102358.0bded5e3.eric@bisonsystems.net>
Karl Dubost wrote:
>
> Hi,
> 
> About API and too large response limit.
> Jon Masse (cced) asked me a question about API and the right HTTP
> Code to send back to the client. 
> 
> Creating an API returning N posts starting at an index x
> with a limit of N <= 500.
> 
> Someone sends an HTTP GET with n=1000
> http://api.example.org/post?start=1&n=1000
> 
>     GET /post?start=1&n=1000 HTTP/1.1
>     Host: api.example.org
>     User-Agent: FooBar v1
>     Accept: application/json
> 
> What should the API developer send back?
> 
> * 200 OK and a Link for the pagination?
>   Link: </post?start=500&n=500>; rel="Next"
>   (but the client might not know it used an out of range value
> 
> * a 4xx to communicate that there is an out of range value?
>   (but which 4xx? It doesn't seem there is one appropriate.
>   403 doesn't seem right)
> 

200 is definitely wrong, 400 is the appropriate failure code, or use a
307 redirect (the post count may grow to accommodate the request, so
don't use 301).

-Eric
Received on Thursday, 14 July 2011 16:24:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 27 April 2012 06:51:44 GMT