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

Mark Nottingham <mnot@mnot.net> Thu, 07 March 2013 14:45 UTC

Return-Path: <mnot@mnot.net>
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 CC75621F8D87 for <apps-discuss@ietfa.amsl.com>; Thu, 7 Mar 2013 06:45:24 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.599
X-Spam-Level:
X-Spam-Status: No, score=-102.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, USER_IN_WHITELIST=-100]
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 QnyqEmPq4Jye for <apps-discuss@ietfa.amsl.com>; Thu, 7 Mar 2013 06:45:24 -0800 (PST)
Received: from mxout-08.mxes.net (mxout-08.mxes.net [216.86.168.183]) by ietfa.amsl.com (Postfix) with ESMTP id A8E6421F8D85 for <apps-discuss@ietf.org>; Thu, 7 Mar 2013 06:45:23 -0800 (PST)
Received: from [10.0.251.33] (unknown [195.99.168.174]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id BBA11509B8; Thu, 7 Mar 2013 09:45:21 -0500 (EST)
Content-Type: text/plain; charset="iso-8859-1"
Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\))
From: Mark Nottingham <mnot@mnot.net>
In-Reply-To: <CAC5ZT9V-1T+Te-JK6aEUiTZyrcFxMVeB-43Ldu-0pN5nmpJ2QQ@mail.gmail.com>
Date: Thu, 07 Mar 2013 14:45:19 +0000
Content-Transfer-Encoding: quoted-printable
Message-Id: <A0D1F874-7288-48A8-8032-A819B42DBF8E@mnot.net>
References: <CAC5ZT9WndY1JHYWDuGAnd0=Rg6XiNMhtOoTPtUrnk+teZ33ebA@mail.gmail.com> <5137C467.90805@berkeley.edu> <CAC5ZT9V-1T+Te-JK6aEUiTZyrcFxMVeB-43Ldu-0pN5nmpJ2QQ@mail.gmail.com>
To: Michael Stillwell <mjs@beebo.org>
X-Mailer: Apple Mail (2.1499)
Cc: 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 14:45:24 -0000

On 07/03/2013, at 1:06 AM, Michael Stillwell <mjs@beebo.org> wrote:

> 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.

Right. This just provides them a way to do that, without having to invent a new format each time. I've seen APIs that define lots of new error media types, something that's nasty and heavyweight. 


> 
>> 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.

The benefit is that they don't have to invent their own JSON structure, get the right semantics for it, etc. etc. Is that a huge benefit? Not really, but it helps. 


> 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!


Not quite, but yes, this won't end world hunger. It's a small thing, the real focus is giving help to people who invent their own error formats and trip up in the process (some of the things I've seen really raise the eyebrows, and people spend a *lot* of time trying to get these things right).

Cheers,

--
Mark Nottingham   http://www.mnot.net/