Re: [apps-discuss] draft-nottingham-http-problem

Michael Stillwell <mjs@beebo.org> Thu, 07 March 2013 01:06 UTC

Return-Path: <ithinkihaveacat@gmail.com>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 68F1521F874B for <apps-discuss@ietfa.amsl.com>; Wed, 6 Mar 2013 17:06:35 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.978
X-Spam-Level:
X-Spam-Status: No, score=-1.978 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, NO_RELAYS=-0.001]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FKdRG9hVI8gP for <apps-discuss@ietfa.amsl.com>; Wed, 6 Mar 2013 17:06:34 -0800 (PST)
Received: from mail-ie0-x22e.google.com (mail-ie0-x22e.google.com [IPv6:2607:f8b0:4001:c03::22e]) by ietfa.amsl.com (Postfix) with ESMTP id 84C1821F84B8 for <apps-discuss@ietf.org>; Wed, 6 Mar 2013 17:06:34 -0800 (PST)
Received: by mail-ie0-f174.google.com with SMTP id k10so10420034iea.33 for <apps-discuss@ietf.org>; Wed, 06 Mar 2013 17:06:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Iat5uG7YAO40wbcHW4psqvMpw7Ajj8T/FQSHz7JRuMk=; b=Zsphd7ZVzPduFYHVs+Ni+/rWqQpJgC3y2JlmVhNGjjknId7V0OaD/WA+CZtZmPeyQQ C/Uw4HytuhWlssu4soURkuRpWhtjeXU6Ioe8JWbgjK0fHnTEVdeuFEd8idakiGGbZ/wk /72dKB/0xQ4Wh/NGZPvbkjXOmG80AqE2+Angb54aHjzl5zGN30u4KuztCgH3djA+VF2b P4TYje/LJMNpf4KZs/jKuaLjrgONWITN+9YWnmnqgdweyQXv3HDc5i3nMl75mzZl5b5I Mjusl2GKzQrfpX7wgOSNTH1Ae/B58w69LZErzrbtI5IynVvU2uS2fH91blfFt0NeLr8p AxLw==
MIME-Version: 1.0
X-Received: by 10.50.156.133 with SMTP id we5mr13054468igb.51.1362618394145; Wed, 06 Mar 2013 17:06:34 -0800 (PST)
Sender: ithinkihaveacat@gmail.com
Received: by 10.64.97.195 with HTTP; Wed, 6 Mar 2013 17:06:33 -0800 (PST)
In-Reply-To: <5137C467.90805@berkeley.edu>
References: <CAC5ZT9WndY1JHYWDuGAnd0=Rg6XiNMhtOoTPtUrnk+teZ33ebA@mail.gmail.com> <5137C467.90805@berkeley.edu>
Date: Thu, 07 Mar 2013 01:06:33 +0000
X-Google-Sender-Auth: kxph4hm5eR6NeuoOlIhSS__-S8g
Message-ID: <CAC5ZT9V-1T+Te-JK6aEUiTZyrcFxMVeB-43Ldu-0pN5nmpJ2QQ@mail.gmail.com>
From: Michael Stillwell <mjs@beebo.org>
To: Erik Wilde <dret@berkeley.edu>
Content-Type: text/plain; charset="ISO-8859-1"
Cc: mnot@mnot.net, Dmitry Limonov <dmitry.limonov@emc.com>, erik.wilde@emc.com, apps-discuss@ietf.org
Subject: Re: [apps-discuss] draft-nottingham-http-problem
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 07 Mar 2013 01:06:35 -0000

Hiya Erik,

Thanks for your reply.

On Wed, Mar 6, 2013 at 10:34 PM, Erik Wilde <dret@berkeley.edu> wrote:

> On 2013-03-06 14:07 , Michael Stillwell wrote:
>>
>> Some questions/thoughts on the "Problem Details for HTTP APIs" draft:
>> http://tools.ietf.org/html/draft-nottingham-http-problem-03
>> The existing approach to handling problems seems to be for clients to
>> assume that the combination of a URL (or just domain), a status code,
>> and a media type determines the type of the body.  So clients will
>> interpret { flickr.com, 4xx, application/json } in one way, and {
>> twitter.com, 4xx, application/json } in another.
>
> why do you assume this is the case? HTTP status codes are defined by HTTP,
> and they always mean the same for all HTTP interactions, regardless of the
> domain or anything else. if you get a 404, then it means what
> http://tools.ietf.org/html/rfc2616#section-10.4.5 says it means, not less
> and not more.

Ah to clarify this point, all I mean is that under existing practice,
if clients get a response with a 4xx status code, and a media type of
application/json, how they process that response varies according to
the domain it came from.

So I'm not saying that the response can redefine the 428 status code
to mean "image does not contain picture of a cat"--but I think it can
contain machine-readable information that explains how to satisfy the
failed precondition.

> the idea here is that services have the opportunity to provide supplemental
> information *beyond* the HTTP status code. so yes, this supplemental
> information is now runtime information (i.e., not part of HTTP's standard
> status codes). whether it is *shared* is a different issue; it would also be
> perfectly fine if services always define their own problemType URIs, simply
> for the purpose of providing some information that goes beyond what they can
> communicate through HTTP's standard status codes.
>
> sharing of problemType URIs is optional, but it sounds like something that
> may make a lot of sense. for example, when some software is deployed, it may
> choose to always use canonical URIs when sending HTTP problem details.
> clients now could use those problemType URIs to respond to these specific
> errors in a more specific way than to just the vanilla HTTP response.

Maybe an example of the Github API can better illustrate some of the
problems of both sharing and not sharing problemType URIs that I'm
worrying about.

Github's API docs nicely explain how to interpret a their 422 status code:

http://developer.github.com/v3/#client-errors

And so, under the draft, instead of returning "application/json" (I'm
assuming that's what they're returning, they don't actually say), they
would return "application/api-problem+json" (or switch between the two
via conneg).  They then need to decide whether to use their own, or a
shared, problemType.

If they used their own, then clients would need to be Github-specific,
and so this doesn't seem to have much benefit over just returning
"application/json" in the first place and having clients behave
differently based on (in effect) the github.com domain name.

Conversely, whilst it would be nice if Github were able to share a
problemType with other services, I don't think this is easily
achievable.  For example if a field is marked as "invalid", you need
to read the docs to figure out what's wrong (too long? not a
number?)--the problem detail provides no way to programmatically
suggest corrections or fix the request.  It could be enhanced to
provide more useful information, but it's difficult to imagine even a
"create-account" or "add-to-basket" problem details being shared
across services like Amazon, Google, Facebook, and eBay.  Each of
these services has different constraints, and will have
service-specific ways of failing, and so will need different
problemTypes.  Non-shared problemTypes mean non-shared clients, and so
we're back where we started!






Cheers,
Michael