REST: they just don't get it
i read REST, I just don't get it today and just had to hang my head.
there is so much of REST that folks don't get. but saying:
...just use a POST as an RPC call, keep it as simple as possible and be done with it. And don't spend another minute worrying about being RESTful or not.
is just wrong.
while i see lots of 'hey, you put a VERB in the URL!' or 'You're lame if you don't use PUT' kinda talk, i don't see folks talking about some of the most important concepts outlined in Fielding's 1999 dissertation, Architectural Styles and the Design of Network-based Software Architectures - the document that described for the first time (in Chapter 5) what REpresentational State Transfer was about. check the year - 1999. actually, first drafts of the REST model were written as early as 1994! Fielding was part of the team that outlined the massively scalable distributed-networking protocol known to us as HTTP. Fielding was there on the ground floor. his REST model, even almost a decade after it's official release, stands as one of the best attempts to codify some of the key architectural patterns that went into designing HTTP.
and there are several
- Use of separation of concerns via the Client-Server style
- Stateless, self-descriptive messages supported by meta-data
- Support for cache-ability including third-party intermediaries
- A stable, uniform interface understood by all parties.
- A layered, multi-party network where everyone can work safely without having to understand every detail of a transaction
- Support for portable code-on-demand that allows servers to send executable units to clients for local execution
and add to the above vital system-wide constraints these additional patterns so common today we hardly give them much thought:
- the abstraction of Resource Identifiers and Resources (via URIs)
- the abstraction of the Resource and it's Representation (via MIME-types)
- the abstraction of process flow and resource discovery (via Hypermedia links)
- the abstraction of resource access, transfer, and processing (via a single abstract interface) that allows clients, proxies, servers, caches, resolvers, and other agents to work safely together
that's quite a bit of work. quite a bit of *important* work. important work that, even after a decade (almost a century in 'Internet years') continue to thrive, grow, change, and adapt to include new media types, new authentication schemes, and more.
finally, you should note that this rant does not address the 'REST means you *MUST* use PUT and DELETE methods' or 'REST means you can't use a *VERB* in the URI' assertions. that stuff just misses the point. REST is much more than rules about URLs and HTTP method calls.