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

Is it OK to have two URL's for GET's - one for a list of items and one for single items?

Expand Messages
  • Scott Chapman
    I m considering making different URL s for retrieval of a list of sites vs. one site (sites are actual locations on the ground in my scenario): List of sites:
    Message 1 of 3 , Aug 1 1:17 PM
    • 0 Attachment
      I'm considering making different URL's for retrieval of a list of sites vs.
      one site (sites are actual locations on the ground in my scenario):

      List of sites: http://www.../sites?name1=value1&name2=value2
      Single site: http://www.../site/2

      Is this considered Ok for good REST development or should the "sites" (plural)
      URL be used in all cases?

      I am considering this because the implementation on the server side would be
      cleaner, having separate "pages" for list vs. single site returns. I'd like
      to know what people think of this.

      I'm new to RESTful design. Please let me know what the pro's and con's are of
      doing it this way from a design perspective.

      Thanks!
      Scott
    • Justin T. Sampson
      Hi Scott, The same question came up a couple weeks ago -- you ll find several different opinions. But all were agreed that REST itself doesn t suggest one or
      Message 2 of 3 , Aug 1 2:31 PM
      • 0 Attachment
        Hi Scott,

        The same question came up a couple weeks ago -- you'll find several
        different opinions. But all were agreed that REST itself doesn't
        suggest one or the other approach, as long as client code is not
        hard-coded with knowledge of any chosen structure. So it's just a
        matter of human understanding. My own preference is for </sites/>
        (including trailing slash) and </sites/2> (using the plural), treating
        "sites" as a kind of virtual folder. The implementation approach I use
        lets me differentiate those however I want, so they are separate
        "pages" regardless.

        Cheers,
        Justin


        On 8/1/06, Scott Chapman <scott_list@...> wrote:

        > I'm considering making different URL's for retrieval of a list of sites vs.
        > one site (sites are actual locations on the ground in my scenario):
        >
        > List of sites: http://www.../sites?name1=value1&name2=value2
        > Single site: http://www.../site/2
        >
        > Is this considered Ok for good REST development or should the "sites" (plural)
        > URL be used in all cases?
        >
        > I am considering this because the implementation on the server side would be
        > cleaner, having separate "pages" for list vs. single site returns. I'd like
        > to know what people think of this.
        >
        > I'm new to RESTful design. Please let me know what the pro's and con's are of
        > doing it this way from a design perspective.
        >
        > Thanks!
        > Scott
      • S. Mike Dierken
        I think he was asking not only for a resource that is a collection, but also the client providing an explicit list of data elements to return. Although I
        Message 3 of 3 , Aug 1 9:36 PM
        • 0 Attachment
          I think he was asking not only for a resource that is a collection, but also
          the client providing an explicit list of data elements to return.
          Although I haven't thought about it deeply, I would strongly recommend two
          distinct URIs - one for the single data element and one for the collection
          of data.


          > -----Original Message-----
          > From: rest-discuss@yahoogroups.com
          > [mailto:rest-discuss@yahoogroups.com] On Behalf Of Justin T. Sampson
          > Sent: Tuesday, August 01, 2006 2:31 PM
          > To: rest-discuss@yahoogroups.com
          > Subject: Re: [rest-discuss] Is it OK to have two URL's for
          > GET's - one for a list of items and one for single items?
          >
          > Hi Scott,
          >
          > The same question came up a couple weeks ago -- you'll find
          > several different opinions. But all were agreed that REST
          > itself doesn't suggest one or the other approach, as long as
          > client code is not hard-coded with knowledge of any chosen
          > structure. So it's just a matter of human understanding. My
          > own preference is for </sites/> (including trailing slash)
          > and </sites/2> (using the plural), treating "sites" as a kind
          > of virtual folder. The implementation approach I use lets me
          > differentiate those however I want, so they are separate
          > "pages" regardless.
          >
          > Cheers,
          > Justin
          >
          >
          > On 8/1/06, Scott Chapman <scott_list@...> wrote:
          >
          > > I'm considering making different URL's for retrieval of a
          > list of sites vs.
          > > one site (sites are actual locations on the ground in my scenario):
          > >
          > > List of sites: http://www.../sites?name1=value1&name2=value2
          > > Single site: http://www.../site/2
          > >
          > > Is this considered Ok for good REST development or should
          > the "sites"
          > > (plural) URL be used in all cases?
          > >
          > > I am considering this because the implementation on the server side
          > > would be cleaner, having separate "pages" for list vs. single site
          > > returns. I'd like to know what people think of this.
          > >
          > > I'm new to RESTful design. Please let me know what the
          > pro's and con's
          > > are of doing it this way from a design perspective.
          > >
          > > Thanks!
          > > Scott
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.