Resources and Classes
What is the closest thing to a class or type in RESTful systems?
I think it is the media type. URIs name resources, but don't describe types. Media types, on the other hand, describe representations. A representation is the closest thing to an object. Media types describe types of representations.
That's why, the more specific the media types are, the better. Using a generic type like application/xml is like using a generic class like java.lang.Object (or its equivalent in other languages).
Doesn’t that trip up clients like XHR that count on an known XML media type to recognize and parse the XML document?
[Reply]
subbu Reply:
October 3rd, 2008 at 7:44 am
Not necessarily. XHR can recognize XML-ish content-types ending with +xml, such as application/atom+xml, application/mystuff+xml etc.
[Reply]
BC
3 Oct 08 at 5:17 am