Levels of REST HTTP

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

Comments are closed.