[Openstack] XML and JSON for API's

Mark Nottingham mnot at mnot.net
Sun Jun 12 04:51:26 UTC 2011


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

See:
  http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-14#section-8.4.16
vs
  http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-14#section-8.4.7

Cheers,


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







More information about the Openstack mailing list