Wednesday, 6 February 2008
Another Kind of HTTP Negotiation
Here’s one that I’ve been wondering about for a while, for the LazyWeb (HTTP Geek Edition);
PUTs and POSTs can result in the creation of new resources, or changes to the state of existing ones. The response to both can contain one of
- a status message about what happened, or
- a representation of the resource (or most important one, if more than one was created/modified); often signalled by the
Content-Location header, or
- nothing (i.e., just the status line and headers), usually a
204 No Content.
Usually, a server will just choose which of these is most appropriate, and send it for all such requests. However, I can easily see cases where clients would want to hint to the server what they want back; e.g., a mobile client might prefer nothing, for efficiency, while a publisher might want to get a copy of the article they just submitted back, to make sure that they have any changes to the content locally.
My question is how a client should hint what they want back in such responses, and specifically whether this is purely an application-specific concern (and should therefore be expressed in the request-URI, for example), or is worthy of a standard (thereby better being expressed in a header).
BTW, I don’t think this is a form of content negotiation; that’s about the format of the response, and overloading it for this would produce some problems (e.g., how do you differentiate between an HTML status message and a HTML representation? There are also conflicts with probably resolutions of issue 69).