← Back to team overview

openstack team mailing list archive

Re: XML and JSON for API's

 

 Hi Mark,

Yes you are right.  I was not being specific enough.

I am only suggesting that OpenStack handles proper return codes when a client is either asking for a different media type or sends a different media type that is not supported by OpenStack.

Regards
James


On 6/12/11 6:51 AM, Mark Nottingham wrote:
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/





--
James Weir
Chief Technology Officer
james.weir@xxxxxxxxxxxxxx
Linkedin: http://www.linkedin.com/in/jamesweir
Tel: +33 (0)675 23 80 23

www.usharesoft.com
twitter.com/usharesoft



References