Resources and Classes

by subbu on October 2, 2008

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

{ 1 comment… read it below or add one }

1 BC October 3, 2008 at 5:17 am

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:

Not necessarily. XHR can recognize XML-ish content-types ending with +xml, such as application/atom+xml, application/mystuff+xml etc.

[Reply]

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: Netflix REST API

Next post: Double POST and POE