← Back to team overview

openstack team mailing list archive

Re: XML and JSON for API's


On 03/06/2011, at 11:23 PM, James Weir wrote:
> At the very minimum until/if OpenStack supports XML, when I client wishes to receive media type "application/xml" OpenStack should return a:
> HTTP: 415 response
> The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.

I may be misunderstanding what you're trying to do, but the 415 response status code is for unrecognised/unsupported media types in the request's Content-Type itself (i.e., that of the request body), not that asked for in the accept header. 

If you want to say that you don't support any of the formats in the Accept header, you can send a 406 Not Acceptable. However, in HTTP you aren't required to; i.e., the Accept header doesn't define a closed set, UNLESS it contains */*;q=0 (which basically says "don't send me anything else.").



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

Follow ups