--- In email@example.com, Hugh Winkler <hughw@h...> wrote:
> Say you have a query service that returns a bag of items, e.g.
> 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
> 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.