ubervu
Apple iPhone
Nexus One
+ Add

EMAIL ALERTS: SUBSCRIBE
Updated 2 months ago

Source:
http://www.subbu.org/
One of the recurring debates in the REST community is the use of media types. There are two opinions about the use of media types.
Opinion 1: Web services must use standard media types to be RESTful.
Opinion 2: Custom media types are necessary to keep interactions visible, and to serve as contracts.
Of these, the first one is based on a literal interpretation of the following from Roy Fielding’s thesis (emphasis mine).
REST enables intermediate processing ...
More social media conversations about: medium type, message, application, xml, semantics, approach, format, admin, uri, roy, client, interoperability, visibility, plumbing, media
Showing 19 relevant reactions out of 26.

My blog post on media types is now 15 pages long in print with all the comments - http://bit.ly/6ARAgP
Once the message gets into the app runtime (e.g. JAX-RS) routing is not a big problem, but I am talking about the message routing from the time it reaches some front-end proxy till the time it is fed into a runtime. This gets more interesting when you consider homegrown/commercial CDNs setup with origin servers half-way across the globe. When developers make choices about URIs and media types, they ... See all content
JAX-RS can route based on media type. That is not the problem. The problem resides in the fact that most (all?) JAX-RS implementations are built on top of a servlet container. Each web deployment is its own classloader and thus you can’t version classes within it. I don’t know of any servlet implementations that allow you to bind different web deployments to the same URL scheme.
I don’t think your PO/Album example is a good one. A better one would be an Oracle Financials PO vs. a SAP PO. Or a Saleforce.com contact vs. a Thunderbird contact. If a client receives a URL how is it supposed to ask for, or find out a specific XML format exists? Conneg + custom media types is one way. Links are another. One causes an explosion of media types, the other an explosion of links ... See all content
@stilkov http://trunc.it/4p34z on media types in REST: 'If the goal is versioning, use version identifiers in URIs.' What do you think?

Interesting discussion about media types in RESTful apps http://j.mp/8dHfuE
I think his assertion that “A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources” argues for the use of custom mime types. Otherwise it would have been more correct to say “choosing the media types”.
It is not more correct to say “choosing” as this would preclude creation of new media types. Neither
...
See all content
A small variation I’ve had success with is to stick with standard media types but to add link headers with further type (or at least type-like) information.
In described_routes (on hold unfortunately while the URI Template standard gets redrafted), the type identifiers come in the form of URIs that point to URI Template-based metadata, making the application nicely self-describing and
...
See all content

Social comments and analytics for this post…
This post was mentioned on Twitter by mamund: Media Types and Plumbing http://ff.im/-dgjLN…
Interestingly, there are several who would disagree with your interpretation. Having watched/participated in this debate a few times, I remain agnostic of either interpretation.
It is better to go beyond the terminology and interpretations and look at the problem being solved and its viability. If you’re convinced that your XML needs a new media type, just make sure that there are no
...
See all content
Hi, Thanks for another great post.
My understanding is Adam’s, and I arrived via the same quote of Feilding’s. So I’d appreciate your thoughts no his comments/observations.
On the version issue: I’d come to the point of thinking it is so endemic it should be dealt with at the entry point. Taking Roy’s HATEOS literally I thought to make versioning such
...
See all content
Subbu,
I don’t think Dr. Fielding intended for the first option to be the “correct” understanding of how to use mime types. In his blog post of last year titled REST APIs must be hypertext-driven he writes:
A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources and driving application state, or
...
See all content
Subbu:
great to see you are blogging again ! Pete, good to see you are still working on the versioning problem. That’s a hard one to crack.
This discussion sounds a bit heretic to me and I am afraid Roy is going to slap both of you on the wrist.
The real RESTful way to handle interactions is “bookmarks”. Bookmarks can have versions in their URI. You are
...
See all content
Version ids in URIs is a safe bet, but not a cheap one. It’s hard to implement on the server side and, at least for some types of clients,hard to implement on the client side. It makes it more difficult to evolve applications and to decommission obsolete formats.
You didn’t really answer the final questions in my previous comment. I see the appeal of staying on the beaten path
...
See all content
When using namespaces to determine the semantics of the message how do you cope with an evolving set of application semantics? For example, consider the situation where the server needs to introduce some new semantics that are incompatible with existing PO format. How would you go about providing the new format to those clients that can handle it while simultaneously providing older clients with the ... See all content

Media Types and Plumbing: On the other hand, most of the HTTP plumbing (e.g. proxies and firewalls), and HTTP plumb... http://bit.ly/6C424e
Follow us
FEEDBACKTwitterFacebook