Loading ...
Sorry, an error occurred while loading the content.

Re: [rest-discuss] Link relations [was: A media type for case files, dossiers and documents]

Expand Messages
  • Eric J. Bowman
    ... Minting resource-specific media types is a REST anti-pattern, exactly the sort of coupling REST seeks to avoid. This thread may help:
    Message 1 of 88 , Nov 30, 2010
    • 0 Attachment
      Kevin Duffey wrote:
      >
      > 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.
      >

      Minting resource-specific media types is a REST anti-pattern, exactly
      the sort of coupling REST seeks to avoid. This thread may help:

      http://tech.groups.yahoo.com/group/rest-discuss/message/16793

      Your /users, /orders, /sellers and /bids resources can all be
      represented by HTML: media type != resource type.

      -Eric
    • Peter Williams
      On Sun, Dec 5, 2010 at 5:12 PM, Eric J. Bowman wrote: ... I see in table 5-1[1] media type is listed in the modern web
      Message 88 of 88 , Dec 5, 2010
      • 0 Attachment
        On Sun, Dec 5, 2010 at 5:12 PM, Eric J. Bowman <eric@...> wrote:

        <snip/>

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

        [1]: <http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#tab_5_1>

        Peter
        barelyenough.org
      Your message has been successfully submitted and would be delivered to recipients shortly.