Re: [rest-discuss] Link relations [was: A media type for case files, dossiers and documents]
- Kevin Duffey wrote:
>Minting resource-specific media types is a REST anti-pattern, exactly
> I am still struggling to understand when to use different media types
> correctly. If the API I am providing provides a unique solution, but
> I am returning chunks of xml (or json) that represent a specific
> resource, do all these different resources that belong to the overall
> API use the same media type, or should they use different media
> types, one for each resource? I mean, if I
> have /users, /orders, /sellers and /bids, should I be using something
> like application/vnd.com.mycompany.orders+xml for /orders? I've
> resorted back to using application/xml and application/json for the
> convenience, but I am not opposed to using application specific or
> even resource specific media types if that is a best practices that
> the REST community at large is leaning towards.
the sort of coupling REST seeks to avoid. This thread may help:
Your /users, /orders, /sellers and /bids resources can all be
represented by HTML: media type != resource type.
On Sun, Dec 5, 2010 at 5:12 PM, Eric J. Bowman <eric@...> wrote:
> Anyway, it was previously discussed that the sentence in question is a
> bit buggy, which is in part to blame for the confusion. REST can be
> instantiated over IP by any protocol using media types, and meeting the
> other constraints like caching, not just by HTTP. But the media type
> is the means by which resource and representation are decoupled.
I see in table 5-1 "media type" is listed in the modern web
examples column. That does seem to bolster your argument. However,
the dissertation uses the term while describing the style rather than
http specifically. Your interpretation would seem to imply that a
stack (networking system and restful application protocol) that
eschewed iana registered media types would have to have to use a
different term for "the flavor of representations".
Perhaps it is a bug that the dissertation uses "media type" in the way
it does. However, that cannot be undone. Given that the dissertation
does use the term the way it does i stand by my assertion that there
are two valid uses of "media type". One which means a data format
that is registered with iana, and another that means a type, defined
by a specification, of representation used in a restful system.
Regardless, it seems a point of little importance.