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

URI Templates & Patterns

Expand Messages
  • Steve G. Bjorg
    I m looking for some feedback on URI patterns. I just recently found out about URI templates [1] and have been scratching my head on how they could be
    Message 1 of 3 , Jan 15, 2007
      I'm looking for some feedback on URI patterns. I just recently found
      out about URI templates [1] and have been scratching my head on how
      they could be extended to also provide URI patterns.

      For example:
      http://server/{first}/{last}

      This URI could be used to produce or consume a URI such as:
      http://server/john/doe

      However, the template syntax doesn't work for matching query parameters:
      http://server/{first}/{last}?maxcount={maxrecords}&offset={offset}

      In this case, producing an URI is simple, but for using it as a
      pattern, a few questions arise:
      * How would one indicate that 'maxcount' and 'offset' are optional
      parameters?
      * How would one indicate that they are mandatory?


      How about using brackets to identify optional parameters?
      http://server/{first}/{last}?[maxcount={maxrecords}]&offset={offset}

      Would it make sense to combine them? For example to indicate that
      both parameters are needed or neither?
      http://server/{first}/{last}?[maxcount={maxrecords}&offset={offset}]

      How about either/or choices using vertical bar (|)?
      http://server/{first}/{last}?[maxcount={maxrecords}&[offset={offset}|page={page}]]

      Does this make sense? How have you dealt with matching URIs?


      Cheers,

      - Steve

      --------------
      Steve G. Bjorg
      http://www.mindtouch.com
      http://www.opengarden.org


      [1] http://www.ietf.org/internet-drafts/draft-gregorio-uritemplate-00.txt
    • S. Mike Dierken
      I m more interested in the generation of URI, rather than the parsing as I would use regular expressions to parse. It would be very handy to have the URI
      Message 2 of 3 , Jan 15, 2007
        I'm more interested in the generation of URI, rather than the parsing as I
        would use regular expressions to parse.
        It would be very handy to have the URI templates support indicating optional
        output, especially for query terms.


        > -----Original Message-----
        > From: rest-discuss@yahoogroups.com
        > [mailto:rest-discuss@yahoogroups.com] On Behalf Of Steve G. Bjorg
        > Sent: Monday, January 15, 2007 12:04 PM
        > To: rest-discuss@yahoogroups.com
        > Subject: [rest-discuss] URI Templates & Patterns
        >
        > I'm looking for some feedback on URI patterns. I just
        > recently found out about URI templates [1] and have been
        > scratching my head on how they could be extended to also
        > provide URI patterns.
        >
        > For example:
        > http://server/{first}/{last}
        >
        > This URI could be used to produce or consume a URI such as:
        > http://server/john/doe
        >
        > However, the template syntax doesn't work for matching query
        > parameters:
        > http://server/{first}/{last}?maxcount={maxrecords}&offset={offset}
        >
        > In this case, producing an URI is simple, but for using it as
        > a pattern, a few questions arise:
        > * How would one indicate that 'maxcount' and 'offset' are
        > optional parameters?
        > * How would one indicate that they are mandatory?
        >
        >
        > How about using brackets to identify optional parameters?
        > http://server/{first}/{last}?[maxcount={maxrecords}]&offset={offset}
        >
        > Would it make sense to combine them? For example to indicate
        > that both parameters are needed or neither?
        > http://server/{first}/{last}?[maxcount={maxrecords}&offset={offset}]
        >
        > How about either/or choices using vertical bar (|)?
        > http://server/{first}/{last}?[maxcount={maxrecords}&[offset={o
        > ffset}|page={page}]]
        >
        > Does this make sense? How have you dealt with matching URIs?
        >
        >
        > Cheers,
        >
        > - Steve
        >
        > --------------
        > Steve G. Bjorg
        > http://www.mindtouch.com
        > http://www.opengarden.org
        >
        >
        > [1]
        > http://www.ietf.org/internet-drafts/draft-gregorio-uritemplate-00.txt
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
      • Mike Schinkel
        ... FYI, the list to discuss URI Templates is [uri@w3.org]. URI Templates is a great piece of work. ... I m pretty sure the syntax for option is a trailing
        Message 3 of 3 , Jan 15, 2007
          Steve G. Bjorg wrote:
          > I'm looking for some feedback on URI patterns. I just
          > recently found out about URI templates [1] and have been
          > scratching my head on how they could be extended to also
          > provide URI patterns.

          FYI, the list to discuss URI Templates is [uri@...]. URI Templates is a
          great piece of work.

          > For example:
          > http://server/{first}/{last}
          >
          > This URI could be used to produce or consume a URI such as:
          > http://server/john/doe
          >
          > However, the template syntax doesn't work for matching query
          > parameters:
          > http://server/{first}/{last}?maxcount={maxrecords}&offset={offset}
          >
          > In this case, producing an URI is simple, but for using it as
          > a pattern, a few questions arise:
          > * How would one indicate that 'maxcount' and 'offset' are
          > optional parameters?
          > * How would one indicate that they are mandatory?
          >
          > How about using brackets to identify optional parameters?
          > http://server/{first}/{last}?[maxcount={maxrecords}]&offset={offset}
          >
          > Would it make sense to combine them? For example to indicate
          > that both parameters are needed or neither?
          > http://server/{first}/{last}?[maxcount={maxrecords}&offset={offset}]

          I'm pretty sure the syntax for option is a trailing question mark within the
          braces, i.e.:

          http://server/{first}/{last}?maxcount={maxrecords?}&offset={offset?}

          The idea here is that if maxrecords is null then all of
          "maxcount={maxrecords?}" would be omitted and same for offset (I think. I
          hope.)

          >
          > How about either/or choices using vertical bar (|)?
          >
          http://server/{first}/{last}?[maxcount={maxrecords}&[offset={offset}|page={p
          age}]]
          >

          I had proposed a comma, but since I proposed it occurred to me that a
          vertical bar would be more consistent with other languages use of an "or"
          operator so to me, yes it makes sense.

          That said, I cc'd [uri@...]; you can review the archive and sign up at
          [1].

          --
          -Mike Schinkel
          http://www.mikeschinkel.com/blogs/
          http://www.welldesignedurls.org/
          "It never ceases to amaze how many people will proactively debate away
          attempts to improve the web..."

          [1] http://lists.w3.org/Archives/Public/uri/
        Your message has been successfully submitted and would be delivered to recipients shortly.