Re: API Pagination limit

"Eric J. Bowman" <eric@bisonsystems.net> Thu, 14 July 2011 16:25 UTC

Return-Path: <ietf-http-wg-request@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 783CB228011 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 14 Jul 2011 09:25:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.599
X-Spam-Level:
X-Spam-Status: No, score=-10.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X4ymeAkMtgPh for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 14 Jul 2011 09:25:21 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 23115228010 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 14 Jul 2011 09:25:21 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.69) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1QhOia-00038o-74 for ietf-http-wg-dist@listhub.w3.org; Thu, 14 Jul 2011 16:24:52 +0000
Received: from aji.keio.w3.org ([133.27.228.206]) by frink.w3.org with esmtp (Exim 4.69) (envelope-from <eric@bisonsystems.net>) id 1QhOiT-00036P-8L for ietf-http-wg@listhub.w3.org; Thu, 14 Jul 2011 16:24:45 +0000
Received: from mxout-08.mxes.net ([216.86.168.183]) by aji.keio.w3.org with esmtp (Exim 4.72) (envelope-from <eric@bisonsystems.net>) id 1QhOiP-00043c-0I for ietf-http-wg@w3.org; Thu, 14 Jul 2011 16:24:44 +0000
Received: from bigbison (unknown [65.117.211.162]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id CDB5F50A5C; Thu, 14 Jul 2011 12:24:13 -0400 (EDT)
Date: Thu, 14 Jul 2011 10:23:58 -0600
From: "Eric J. Bowman" <eric@bisonsystems.net>
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>
In-Reply-To: <43A715E2-14AB-4229-810C-84078E1189C9@opera.com>
References: <43A715E2-14AB-4229-810C-84078E1189C9@opera.com>
Organization: Bison Systems Corporation
X-Mailer: Sylpheed 3.1.1 (GTK+ 2.10.14; i686-pc-mingw32)
Mime-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=216.86.168.183; envelope-from=eric@bisonsystems.net; helo=mxout-08.mxes.net
X-W3C-Hub-Spam-Status: No, score=-0.6
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, RCVD_IN_RP_RNBL=1.31, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001
X-W3C-Scan-Sig: aji.keio.w3.org 1QhOiP-00043c-0I 0aacc961f616c36b18b707911277f958
X-Original-To: ietf-http-wg@w3.org
Subject: Re: API Pagination limit
Archived-At: <http://www.w3.org/mid/20110714102358.0bded5e3.eric@bisonsystems.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/10942
X-Loop: ietf-http-wg@w3.org
Sender: ietf-http-wg-request@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>
Resent-Message-Id: <E1QhOia-00038o-74@frink.w3.org>
Resent-Date: Thu, 14 Jul 2011 16:24:52 +0000

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