[gcs-pcs-list] Revisiting 415 vs 406

Leigh Dodds leigh at ldodds.com
Wed Mar 8 15:29:10 EST 2006


(assigned a new subject line to keep discussion separate
from voting)

Daniel Chudnov wrote:

> First - as a point of information, see this thread:
> 
>   http://cipolo.med.yale.edu/pipermail/gcs-pcs-list/2006-March/000473.html

Thanks for the pointer!

>Rob Sanderson wrote, on Wed, Mar 08, 2006 at 05:50:15PM +0000:

>>Isn't the 'entity' here the object identified by the URI?

 >Daniel Chudnov wrote:

> I think the "entity" here should be "UNAPI?uri=URI&format=FORMAT", which
> is to say, please, server, give me URI in FORMAT, or, "this server's
> representation of URI in FORMAT".  That contrasting with "the object
> identified by the URI."

The relevant section of RFC 2616 is Section 7, 
http://rfc.net/rfc2616.html#p42:

"Request and Response messages MAY transfer an entity if
not otherwise restricted by the request method or response status
code. An entity consists of entity-header fields and an entity-body, 
although some responses will only include the entity-headers."

And an Entity is decomposed into Entity headers (e.g. Content-* headers)
and an Entity Body, e.g. contents of a POST request, response from
a GET request.

The Request URL is therefore not formally part of the Entity. It
identifies the resource to which the request is addressed.

So typically a "415 Unsupported Media Type" would be returned by a
server to which you'd POST'd (say) an Atom document and that
server only understood RSS. And that doesn't fit the unAPI use
case.

"406 Not Acceptable" is defined for use where the client wants a
specific format and the server can't provide it. Reading, 
http://rfc.net/rfc2616.html#p67 we get:

"
The resource identified by the request is only capable of
generating response entities which have content characteristics
not acceptable according to the accept headers sent in the
request.
"

Which seems a good fit for an unAPI implementation not being able
to fulfill a particular FORMAT request.

That section also includes some best practice advice:

"
...the response SHOULD include an entity containing a list of
available entity characteristics and location(s) from which
the user or user agent can choose the one most appropriate.
"

So you might want to consider encouraging implementations
to return the 406 status code AND the same response body
as they would for GET UNAPI?uri=URI, i.e. the list of
available formats for that URI.

"Sorry guv, can't do that, try one of these instead" :)

Cheers,

L.


-- 
Home: http://www.ldodds.com      | "Simplicity is the ultimate
Blog: http://www.ldodds.com/blog | sophistication" -- Leonardo da Vinci


More information about the gcs-pcs-list mailing list