Jim Webber ambushed by REST advocates

Filed in Uncategorized Leave a comment

Now, that’s cute.

I’ll get right to the point. He writes;

However, in the asynchronous case, imagine your Web Service is just like a letterbox. Letters happily fit into the letterbox and get processed by the back-end (i.e. you), but the 42″ plasma screen TV you ordered doesn’t fit into the letterbox – it doesn’t match the physical dimensions (as per its “schema”). This seems RESTful, no?

Absolutely.

The fact is that regular Web Services have a far more uniform interface than the REST style. I’ve laid down the challenge before, but you can’t get much more uniform than one (imaginary) verb, can you?

That’s really good to hear you say that Web services have uniform semantics. But it’s impossible for them to be more uniform than REST, because REST prescribes uniform interface semantics by definition. That verb you talk about – “processThis” – if it is indeed uniform, then it has semantics that are, for the purposes of this discussion, identical to HTTP POST. And you can build a perfectly RESTful system with just that one verb, and it would be accurately characterized as loosely coupled and based on document exchange. In fact, I just built one a couple of weeks ago like that for pumping three channels of seismographic data from a digitizer to a communications controller. It’s just that in my experience, for most applications, you can build a better RESTful system with additional verbs, in particular GET. For example, if there were any need to have my comms controller initiate the request for data, I’d use GET.

The other approach to requesting data is to, for example, submitting documents which describe query terms or templates to services which process them and return the results. And that also has its place in RESTful systems, including ones I’ve developed. But when you don’t have to query, e.g. when the endpoint identifier for the service/resource to which you POST that document identifies something stateful, then GET is perfect for retrieving that state (such as the aforementioned seismic data). And of course, URIs makes the perfect endpoint identifier because they’re easily identified and contain all the information you need to grab the data (at least the good ones do 8-), without needing to know how to do a query on them.

Anyhow, this discussion is super-duper encouraging from my POV. We’ve come a long way from early Web Services Architecture WG meetings where folks were claiming things like “GET, PUT, and POST are only good for browsers”, or “REST requires humans”. A long way, indeed.

TOP