Update, 2005.07.07 … I’ve neglected to mention that a long time ago, Roy Fielding corrected me about this. These are really levels of HTTP, not REST.
REST has two very different meanings, at least to me. I’ve never really seen them identified as such; Sean has hinted at it in the past, but not as clearly. Taking a cue from the various levels of Inversion of Control, I propose the following Levels of REST:
REST Type 0
GET = data-retreival; POST = everything else / arbritrary-method-invocation
Note that this is the web as experienced through most browsers [*], which only really support GET and POST. This style is characterized by “http://host.whatever.tld/path?do=save” or “?action=buyNow” or “?bite=me”. Okay, sure, both of those are GET-style URIs, but imagine them as POSTs. Now, imagine them as GETs which they usually are…
MarkB notes that the server provides the “save” of “do=save”, which is important. However … in either case, POST doesn’t mean new subordinate resource so much as “do this!”, which sucks.
REST Type 1
GET, PUT, POST, DELETE are defined as per RFC 2616, and used accordingly.
Note that the more general form of this includes WebDAV and other constrained-interface … uh … interfaces. Moreover, GET and POST have meanings beyond, simply, ways to enforce cache-control.
[*]: Thanks, Jon
Random evening http://del.icio.us/ browsing brought be across http://www.mnot.net/python/http/, which is awesome. I was having similar fun over the weekend utilizing python’s support for overriding the behavior of the dictionary-syntax with __{get,set,del}item__.
It’s a similar type of beauty as the constrained interface of HTTP … the power comes in some part because of the interface constraint…
In any case, his example makes it slightly unclear what the mapping is…
web = Dict()
GET
getResp = web[’http://asynchronous.org/blog’]
PUT
web[’http://asynchronous.org/blog’] = newData
DELETE
del web[’http://asynchronous.org/blog’]
POST
postResp = web(’http://asynchronous.org/blog’, newResourceData )
Very cool.
Update: More from the source.
So there’s been a bit of noise about a new sysadmin program from Sun called DTrace. From the home page:
DTrace provides a powerful infrastructure to permit administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs.
That sounds relatively boring. But check out this Introducing DTrace post.
Wow.
I don’t do much sysadmin anymore, but when I did I wanted exactly that tool. I’d asked myself that question numerous times, and always came up short on ways to figure it out. Now, someone should wrap it in a application layer that focuses on detecting anomalous programs from a security perspective.