API Pagination limit

Karl Dubost <karld@opera.com> Thu, 14 July 2011 15:32 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 0BC1621F8B5A for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 14 Jul 2011 08:32:11 -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 seOnCC86tJ2B for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 14 Jul 2011 08:32:07 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id C776821F870F for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 14 Jul 2011 08:32:05 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.69) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1QhNs8-0001FC-C4 for ietf-http-wg-dist@listhub.w3.org; Thu, 14 Jul 2011 15:30:40 +0000
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.69) (envelope-from <karld@opera.com>) id 1QhNrx-0000lI-Uo for ietf-http-wg@listhub.w3.org; Thu, 14 Jul 2011 15:30:29 +0000
Received: from smtp.opera.com ([213.236.208.81]) by maggie.w3.org with esmtp (Exim 4.72) (envelope-from <karld@opera.com>) id 1QhNrt-0006tk-US for ietf-http-wg@w3.org; Thu, 14 Jul 2011 15:30:29 +0000
Received: from [10.0.1.3] (modemcable082.46-82-70.mc.videotron.ca [70.82.46.82]) (authenticated bits=0) by smtp.opera.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p6EFTr6R003767 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 14 Jul 2011 15:29:54 GMT
Content-Transfer-Encoding: quoted-printable
From: Karl Dubost <karld@opera.com>
Content-Type: text/plain; charset="us-ascii"
Message-Id: <43A715E2-14AB-4229-810C-84078E1189C9@opera.com>
Date: Thu, 14 Jul 2011 11:29:52 -0400
Cc: Jon Masse <jmasse@pheromone.ca>
To: httpbis Group <ietf-http-wg@w3.org>
Mime-Version: 1.0 (Apple Message framework v1084)
X-Mailer: Apple Mail (2.1084)
Received-SPF: pass client-ip=213.236.208.81; envelope-from=karld@opera.com; helo=smtp.opera.com
X-W3C-Hub-Spam-Status: No, score=-4.2
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=0.001, SPF_PASS=-0.001
X-W3C-Scan-Sig: maggie.w3.org 1QhNrt-0006tk-US 8b204c6115da3846d9ff55985d763f60
X-Original-To: ietf-http-wg@w3.org
Subject: API Pagination limit
Archived-At: <http://www.w3.org/mid/43A715E2-14AB-4229-810C-84078E1189C9@opera.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/10941
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: <E1QhNs8-0001FC-C4@frink.w3.org>
Resent-Date: Thu, 14 Jul 2011 15:30:40 +0000

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)

Thanks.


-- 
Karl Dubost - http://dev.opera.com/
Developer Relations & Tools, Opera Software