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

RESTfully distinguishing requests without content negotiation

Expand Messages
  • Seairth Jacobs
    I want to provide a syndicated feed of my new blog system. For starters, I intend to support the following specs: RSS 0.92 RSS 2.0 However, how would I
    Message 1 of 12 , Feb 27, 2003
      I want to provide a syndicated feed of my new blog system. For starters, I
      intend to support the following specs:

      RSS 0.92
      RSS 2.0

      However, how would I RESTfully determine which version to return to a given
      request? Getting a request Accept: header value of "text/xml" or
      "application/rss+xml" wouldn't necessarily do any good (would it?). As a
      result, I have implemented a query parameter called "rss" which can have the
      values of "0.92" or "2.0". However, I have seen some other blog systems
      (most notably Sam Ruby's [1]) that use pseudo-extensions (".rss", ".rss2")
      to acheive the same goal.

      So, either way you look at it, a given resource could have three URIs. Each
      URI returns a slightly different representation of the resource (e.g.
      additional data in RSS 2.0 that's not in RSS 0.92, etc.). To some extent, I
      think this is okay, RESTfully speaking. However, this brings into question
      the need for content negotiation.

      When should one technique be used above another? When conneg is not an
      option, what is the best technique to use, and is that technique nothing but
      a kludge?

      ---
      Seairth Jacobs
      seairth@...

      [1] http://www.intertwingly.net/rss/
    • S. Alexander Jacobson
      The correct answer is to define another MIME type. e.g. application/rss2+xml Until it is officially in IANA, use application/x-rss2+xml Blurring MIME types
      Message 2 of 12 , Feb 27, 2003
        The correct answer is to define another MIME type.
        e.g. application/rss2+xml

        Until it is officially in IANA, use
        application/x-rss2+xml

        Blurring MIME types just erodes MIME.

        -Alex-

        ___________________________________________________________________
        S. Alexander Jacobson i2x Media
        1-212-787-1914 voice 1-603-288-1280 fax



        On Thu, 27 Feb 2003, Seairth Jacobs wrote:

        > I want to provide a syndicated feed of my new blog system. For starters, I
        > intend to support the following specs:
        >
        > RSS 0.92
        > RSS 2.0
        >
        > However, how would I RESTfully determine which version to return to a given
        > request? Getting a request Accept: header value of "text/xml" or
        > "application/rss+xml" wouldn't necessarily do any good (would it?). As a
        > result, I have implemented a query parameter called "rss" which can have the
        > values of "0.92" or "2.0". However, I have seen some other blog systems
        > (most notably Sam Ruby's [1]) that use pseudo-extensions (".rss", ".rss2")
        > to acheive the same goal.
        >
        > So, either way you look at it, a given resource could have three URIs. Each
        > URI returns a slightly different representation of the resource (e.g.
        > additional data in RSS 2.0 that's not in RSS 0.92, etc.). To some extent, I
        > think this is okay, RESTfully speaking. However, this brings into question
        > the need for content negotiation.
        >
        > When should one technique be used above another? When conneg is not an
        > option, what is the best technique to use, and is that technique nothing but
        > a kludge?
        >
        > ---
        > Seairth Jacobs
        > seairth@...
        >
        > [1] http://www.intertwingly.net/rss/
        >
        >
        >
        > To unsubscribe from this group, send an email to:
        > rest-discuss-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
      • S. Mike Dierken
        ... From: ... attached ... In HTTP, the resource is the full URI including the query terms. This means that there are a /lot/ of
        Message 3 of 12 , Feb 27, 2003
          ----- Original Message -----
          From: <dave.cantrell@...>

          > In other words, given the following URL:
          >
          > http://www.my-server.com/foo?a=1&b=2
          >
          > Is the "noun" resource http://www.my-server.com/foo with parameters
          attached
          > to the query, or is it http://www.my-server.com/foo?a=1&b=2 ?

          In HTTP, the resource is the full URI including the query terms. This means
          that there are a /lot/ of resources. A resource is not always a concrete
          implementation 'code object' - it is more often a conceptual information
          entity.
        • Chuck Hinson
          ... My favorite example for this is Google. Consider the following URIs: http://www.google.com/search?q=rest+patterns http://www.google.com/search?q=soap+rpc
          Message 4 of 12 , Feb 27, 2003
            S. Mike Dierken wrote:

            >----- Original Message -----
            >From: <dave.cantrell@...>
            >
            >
            >
            >>In other words, given the following URL:
            >>
            >>http://www.my-server.com/foo?a=1&b=2
            >>
            >>Is the "noun" resource http://www.my-server.com/foo with parameters
            >>
            >>
            >attached
            >
            >
            >>to the query, or is it http://www.my-server.com/foo?a=1&b=2 ?
            >>
            >>
            >
            >In HTTP, the resource is the full URI including the query terms. This means
            >that there are a /lot/ of resources. A resource is not always a concrete
            >implementation 'code object' - it is more often a conceptual information
            >entity.
            >
            >
            >
            My favorite example for this is Google. Consider the following URIs:

            http://www.google.com/search?q=rest+patterns
            http://www.google.com/search?q=soap+rpc

            While they differ only by their querystrings, they identify two distinct
            resources. One is a list of all known pages containing the words 'rest'
            and 'pattern', while the other is a list of all known pages containing
            the words 'soap' and 'rpc'.


            --Chuck
          • Vincent D Murphy
            ... this just makes me wonder why we can t use URIs as mime types, like namespace URIs in xml. that way almost anybody can define a mime type without going
            Message 5 of 12 , Feb 28, 2003
              On Friday, February 28, 2003, at 01:32 AM, S. Alexander Jacobson wrote:
              > The correct answer is to define another MIME type.
              > e.g. application/rss2+xml
              >
              > Until it is officially in IANA, use
              > application/x-rss2+xml
              >
              > Blurring MIME types just erodes MIME.

              this just makes me wonder why we can't use URIs as mime types, like
              namespace URIs in xml.

              that way almost anybody can define a mime type without going through
              the IANA.

              maybe i'm missing something obvious and this is a bad idea?
            • Seairth Jacobs
              Frankly, I think this is an excellent idea. In a similar vein, this was my suggested solution to a Meta-Query header conversation over in the
              Message 6 of 12 , Feb 28, 2003
                Frankly, I think this is an excellent idea. In a similar vein, this was my
                suggested solution to a Meta-Query header conversation over in the
                distributed-registry list. My only fear would be that using URIs in fields
                like Accept and Content-Type would break many existing applications. One
                way we could maintain backwards compatibility would be to add another MIME
                type like "alt/uri". When this type was present, it would tell the
                application to look for another header or headers. The name of the
                header(s) would be specific to the protocol. For instance, in HTTP, the
                MIME type might indicate the presence of a header called "Content-Type-URI:"
                or some such.

                ---
                Seairth Jacobs
                seairth@...

                From: "Vincent D Murphy" <vdm@...>
                >
                > On Friday, February 28, 2003, at 01:32 AM, S. Alexander Jacobson wrote:
                > > The correct answer is to define another MIME type.
                > > e.g. application/rss2+xml
                > >
                > > Until it is officially in IANA, use
                > > application/x-rss2+xml
                > >
                > > Blurring MIME types just erodes MIME.
                >
                > this just makes me wonder why we can't use URIs as mime types, like
                > namespace URIs in xml.
                >
                > that way almost anybody can define a mime type without going through
                > the IANA.
                >
                > maybe i'm missing something obvious and this is a bad idea?
              • Joe Gregorio
                ... Actually using the x- types is current discouraged in favor of vendor and personal trees: For convenience and symmetry with this registration scheme,
                Message 7 of 12 , Feb 28, 2003
                  Vincent D Murphy wrote:
                  > On Friday, February 28, 2003, at 01:32 AM, S. Alexander Jacobson wrote:
                  >
                  >>The correct answer is to define another MIME type.
                  >>e.g. application/rss2+xml
                  >>
                  >>Until it is officially in IANA, use
                  >>application/x-rss2+xml
                  >>
                  >>Blurring MIME types just erodes MIME.

                  Actually using the x- types is current discouraged in favor of
                  vendor and personal trees:

                  " For convenience and symmetry with this registration scheme, media
                  type names with "x." as the first facet may be used for the same
                  purposes for which names starting in "x-" are normally used. These
                  types are unregistered, experimental, and should be used only with
                  the active agreement of the parties exchanging them.
                  However, with the simplified registration procedures described above
                  for vendor and personal trees, it should rarely, if ever, be
                  necessary to use unregistered experimental types, and as such use of
                  both "x-" and "x." forms is discouraged."

                  From:
                  RFC 2048 - MIME Registration Procedures
                  ftp://ftp.isi.edu/in-notes/rfc2048.txt

                  >
                  >
                  > this just makes me wonder why we can't use URIs as mime types, like
                  > namespace URIs in xml.
                  >
                  > that way almost anybody can define a mime type without going through
                  > the IANA.
                  >
                  > maybe i'm missing something obvious and this is a bad idea?

                  It is being considered:
                  http://www.w3.org/2001/tag/ilist#uriMediaType-9

                  But given the problems of using URIs to identify namespaces in XML
                  I doubt that the idea will make much progress.

                  -joe

                  --
                  http://BitWorking.org
                  http://WellFormedWeb.org
                • Seairth Jacobs
                  From: Joe Gregorio ... While I could see someone getting carried away with the idea, I don t think that it would be a good idea to
                  Message 8 of 12 , Feb 28, 2003
                    From: "Joe Gregorio" <joe@...>
                    >
                    > >
                    > >
                    > > this just makes me wonder why we can't use URIs as mime types, like
                    > > namespace URIs in xml.
                    > >
                    > > that way almost anybody can define a mime type without going through
                    > > the IANA.
                    > >
                    > > maybe i'm missing something obvious and this is a bad idea?
                    >
                    > It is being considered:
                    > http://www.w3.org/2001/tag/ilist#uriMediaType-9
                    >
                    > But given the problems of using URIs to identify namespaces in XML
                    > I doubt that the idea will make much progress.

                    While I could see someone getting carried away with the idea, I don't think
                    that it would be a good idea to compare XML Namespace URIs and Media Type
                    URI. In my head, they are not the same thing. URI Media Types are just a
                    way to make media type registration distributed, while XML Namespace URIs
                    are used to mix multiple document parts within a single package. Very
                    different usage to me.

                    Besides... just think what this could do for XML Namespaces. :) Instead of
                    using the namespacing mechanism, one could define a media type URI to
                    indicate the usage of a specific set of XML vocabularies. As a result, as
                    long as this media type was encountered, element names, etc. would be
                    uniform across *all* documents. Then you would be able to have your
                    regex-able xml. :)

                    ---
                    Seairth Jacobs
                    seairth@...
                  • Vincent D Murphy
                    ... if using x- and x. is discouraged, and registration is encouraged, this still seems to leaves a single point of failure (the IANA). the IANA is also as
                    Message 9 of 12 , Feb 28, 2003
                      On Friday, February 28, 2003, at 02:29 PM, Joe Gregorio wrote:
                      > Actually using the x- types is current discouraged in favor of
                      > vendor and personal trees:
                      >
                      > " For convenience and symmetry with this registration scheme, media
                      > type names with "x." as the first facet may be used for the same
                      > purposes for which names starting in "x-" are normally used. These
                      > types are unregistered, experimental, and should be used only with
                      > the active agreement of the parties exchanging them.
                      > However, with the simplified registration procedures described above
                      > for vendor and personal trees, it should rarely, if ever, be
                      > necessary to use unregistered experimental types, and as such use of
                      > both "x-" and "x." forms is discouraged."
                      >
                      > From:
                      > RFC 2048 - MIME Registration Procedures
                      > ftp://ftp.isi.edu/in-notes/rfc2048.txt

                      if using x- and x. is discouraged, and registration is encouraged, this
                      still seems to leaves a single point of failure (the IANA).

                      the IANA is also as vulnerable as any other single authority to being
                      hijacked by the US Dept. of Commerce/ICANN etc. acting in the interests
                      of megacorps. witness what happened to DNS. </rant>

                      i just think URIs, being Universal, are a good fit for what mime does
                      now.

                      >> this just makes me wonder why we can't use URIs as mime types, like
                      >> namespace URIs in xml.
                      >>
                      >> that way almost anybody can define a mime type without going through
                      >> the IANA.
                      >>
                      >> maybe i'm missing something obvious and this is a bad idea?
                      >
                      > It is being considered:
                      > http://www.w3.org/2001/tag/ilist#uriMediaType-9
                      >
                      > But given the problems of using URIs to identify namespaces in XML
                      > I doubt that the idea will make much progress.

                      correct me if i'm wrong, but i think the problems of URIs being used to
                      identify namespaces are to do with a lack of understanding of what URIs
                      are, rather than problems arising simply because of the use of URIs per
                      se.

                      IMO the problems can be associated with the same type of people who
                      believe fallacies like 'the web is a filesystem' and 'a URI is a
                      filesystem path, so where's the file'?

                      thanks for your points anyway.
                    • Joe Gregorio
                      ... I agree they re not the same thing, but they are both using an HTTP URI as a unique identifier. Using an HTTP URI as a unique identifier for anything but a
                      Message 10 of 12 , Feb 28, 2003
                        Seairth Jacobs wrote:
                        > From: "Joe Gregorio" <joe@...>
                        >
                        >>>
                        >>>this just makes me wonder why we can't use URIs as mime types, like
                        >>>namespace URIs in xml.
                        >>>
                        >>>that way almost anybody can define a mime type without going through
                        >>>the IANA.
                        >>>
                        >>>maybe i'm missing something obvious and this is a bad idea?
                        >>
                        >>It is being considered:
                        >>http://www.w3.org/2001/tag/ilist#uriMediaType-9
                        >>
                        >>But given the problems of using URIs to identify namespaces in XML
                        >>I doubt that the idea will make much progress.
                        >
                        >
                        > While I could see someone getting carried away with the idea, I don't think
                        > that it would be a good idea to compare XML Namespace URIs and Media Type
                        > URI. In my head, they are not the same thing. URI Media Types are just a
                        > way to make media type registration distributed, while XML Namespace URIs
                        > are used to mix multiple document parts within a single package. Very
                        > different usage to me.

                        I agree they're not the same thing, but they are both using an HTTP URI as a unique identifier.
                        Using an HTTP URI as a unique identifier for anything but a web resource
                        is fraught with problems:

                        1. Users will take those URIs and plug them into a browser. What should they get back?
                        (The "what does a namespace uri dereference to is an [xml-dev] permathread.)
                        2. How do you compare two URIs? Are they case sensitive? Because some parts of an HTTP
                        URI are not case sensitive while some other parts may be case sensitive.
                        What about escaped characters,
                        i.e. does %42 in the URI get decoded or left as is? (How to compare two URIs
                        is another issue on the tags plate: http://www.w3.org/2001/tag/ilist#URIEquivalence-15 )

                        I don't want to throw cold water on the idea, just pointing out that you're wandering
                        into some pretty murky waters :)

                        -joe

                        --
                        http://BitWorking.org
                        http://WellFormedWeb.org
                      • S. Mike Dierken
                        ... From: Vincent D Murphy ... You mean like Content-Type: http://www.dierken.com/Just-Like-html/only/better
                        Message 11 of 12 , Feb 28, 2003
                          ----- Original Message -----
                          From: "Vincent D Murphy" <vdm@...>

                          > this just makes me wonder why we can't use URIs as mime types, like
                          > namespace URIs in xml.
                          You mean like Content-Type:
                          http://www.dierken.com/Just-Like-html/only/better
                        • Vincent D Murphy
                          ... or Content-type: http://www.yaml.org/yaml/1.0
                          Message 12 of 12 , Feb 28, 2003
                            On Friday, February 28, 2003, at 03:52 PM, S. Mike Dierken wrote:
                            > You mean like Content-Type:
                            > http://www.dierken.com/Just-Like-html/only/better

                            or
                            Content-type: http://www.yaml.org/yaml/1.0
                          Your message has been successfully submitted and would be delivered to recipients shortly.