[rest-practices] Media types

David Lutterkort lutter at redhat.com
Fri Apr 16 17:24:58 UTC 2010


On Thu, 2010-04-15 at 12:54 +0100, Mark McLoughlin wrote:
> So, the idea is to have e.g.
> 
>   Accept: application/vnd.rht.rhevm.vm+xml;version=1
> 
> We would only bump the version number if we make an incompatible change
> to the format.

This seems very cumbersome to me, especially for very simple clients:
one of the attractions of REST (over HTTP) is that you can easily whip
up a shell script to do very simple things, like list all my VM's and
their state. Do I really need to look up the media type just to say
'send me a list of VM's as XML' ?

> Clients would not be able to negotiate different
> compatible format versions

Why have version information in the accept header then anyway ? For
HTML, there are two media types: one for XHTML, one for HTML, even
though there are multiple versions of either.

If you want to indicate fine-grained information about the returned
format, either put it in a special HTTP header, or put it into the
returned format - once the client knows they are getting XML or JSON,
they can easily look for that information. Most clients will ignore that
kind of information anyway.

David





More information about the rest-practices mailing list