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

Design question

Expand Messages
  • Hugh Winkler
    Say you have a query service that returns a bag of items, e.g. http://myserver/select-items?color=blue Ignoring performance issues for a moment, would it be
    Message 1 of 2 , May 29, 2003
    • 0 Attachment
      Say you have a query service that returns a bag of items, e.g.

      http://myserver/select-items?color=blue

      Ignoring performance issues for a moment, would it be more RESTful to
      return the "item" representations themselves, or to return URIs where
      the caller may retrieve them?

      Consider whether the list of items specified by
      "http://myserver/select-items?color=blue" changes over time. Seems like
      if the list *does* change, returning the URIs gives the client a way to
      retrieve those items later even if the query no longer returns them
      (e.g. a discontinued item). If the list *doesn't* change, any advantage
      to returning URIs rather than the representations seems a little less
      obvious... and then if you bring performance back into the calculation,
      returning URIs implies at least another round trip.

      Thanks to anyone who can comment on this issue.

      Hugh
    • sem_antico
      ... Either pattern is RESTful as far as I can see. ... way to ... It all depends on your application requirements. There is a general pattern here which I ve
      Message 2 of 2 , Jun 9, 2003
      • 0 Attachment
        --- In rest-discuss@yahoogroups.com, Hugh Winkler <hughw@h...> wrote:
        > Say you have a query service that returns a bag of items, e.g.
        >
        > http://myserver/select-items?color=blue
        >
        > Ignoring performance issues for a moment, would it be more RESTful to
        > return the "item" representations themselves, or to return URIs where
        > the caller may retrieve them?
        Either pattern is RESTful as far as I can see.
        >
        > Consider whether the list of items specified by
        > "http://myserver/select-items?color=blue" changes over time. Seems like
        > if the list *does* change, returning the URIs gives the client a
        way to
        > retrieve those items later even if the query no longer returns them
        > (e.g. a discontinued item). If the list *doesn't* change, any advantage
        > to returning URIs rather than the representations seems a little less
        > obvious... and then if you bring performance back into the calculation,
        > returning URIs implies at least another round trip.

        It all depends on your application requirements. There is a general
        pattern here which I've seen a number of times. One possible solution
        you have not mentioned is to return a list of items *together* with
        the URIs that can be used to address those items individually - then
        you get all the advantages of both approaches.

        This is an example what I think of as a container GET pattern - do you
        serailise the contents of the container, or just return a list of
        pointers to each contained resource?

        >
        > Thanks to anyone who can comment on this issue.
        >
        > Hugh
      Your message has been successfully submitted and would be delivered to recipients shortly.