Geeks With Blogs
My blog on all kinds of stuff...

It's been a while, been busy with work and all that.

I've decided to venture into the realm of RESTful Web Services.  As is popularly quoted, “in theory, theory and practice are the same, but in practice, they are different”.

Trust me, I am still drinking the REST kool-aid and I definitely believe it solves a certain set of problems.  You will be hard pressed however to convince me that there is an architectural style that solves all “web service“-type problems cleanly. 

Having said all that, how do I RESTfully solve a situation like this:

Every order has an associated address.  What a consumer wants to do, is send me a list of orders and have the corresponding address for each order returned, there are no links to be followed afterwords.  Note that I said “a list“, as performance is an issue here i.e. the consumer cannot iterate through their list of orders and for each one, RESTfully (GET) ask for the address.

Questions:

  1. What is the resource?  I'm assuming its “addresses“ since that is the resource that I need returned.
  2. What is the URI? “/addresses/orders“ or “/addresses/query?
  3. GET doesn't seem like an option here, hence, looks like I need to POST my criteria
  4. Does this have be followed with a corresponding GET to actual “retrieve“ the list of addresses or can my POST above handle that as its response.
  5. Am I totally off base? :)

I will state that a lot of business applications that I work with use more complex semantics as opposed to the example (good one for illustration) Dare Obasanjo places here and most of the “samples“ out there are pretty trivial.

I'm hoping Mark Baker,  Paul Prescod or someone out there can weigh in on this.

Thanks.

Posted on Tuesday, April 18, 2006 12:17 PM Architecture | Back to top


Comments on this post: Complex Queries and REST

# re: Complex Queries and REST
Requesting Gravatar...
I am not a REST guru, but I'd be surprised if the answer isn't just what you apparently already expect. Do a single POST to "/orders/query/multi/addresses" (or whatever), it'll send you the results, get on with your life.

For my tastes, this fits quite cleanly into a REST app. This API may not be exactly RESTful, but it's clearly a simple optimization of a set of RESTful GETs. Instead of doing the map() on the client, it happens on the server. Apart from serialization issues, that's the only difference.

Left by Jason Orendorff on May 16, 2006 5:49 AM

Your comment:
 (will show your gravatar)


Copyright © Ebenezer Ikonne | Powered by: GeeksWithBlogs.net