Re: POST in REST

On Wednesday, November 27, 2002, at 05:51  AM, Sandro Hawke wrote:

>
> [ccing www-archive]
>
> I just came across your "REST, RPC, mountains, molehills, and a
> retraction (sort of)" [1] and I *love* the unix/plan9 "everything is a
> file" association.  It makes soooo much sense (to this old unix
> hacker, at least, but I suspect I'm not the only one.)  Has this been
> talked about much elsewhere?

Probably not by anybody else. ;-)  There doesn't seem to be much 
overlap between the OS and Web communities...  when I pointed the plan9 
/ UNIX philosophy ~> REST similarity to Fielding, he seemed to think it 
was a pretty good analogy.

> So GET == get the contents of the file
>    PUT == replace the contents of the file
>    DELETE == remove the file
>    POST == ?

It's rather sloppy and inexact, but this is how I sort of think of 
things:

GET:  someprog < foo
PUT:  somestuff > foo
DELETE:  rm foo
POST:  somestuff >> foo

> TimBL tells me that POST was originally meant to be "create"; you'd
> POST to one resource to create a nearby, related resource.  But I've
> never seen it used directly that way -- it's used more like ioclt,
> like "talk to the man/kernel/server behind the curtain," breaking the
> system's simplicity of interface.   How does it seem to generally be
> viewed by REST folks...?

Ioctl tends to be rather controversial...  Roy, for example, uses ioctl 
as an example of how REST differs from / is more constrained than 
typical UNIXy network filesystems.  (Plan 9 doesn't have ioctl, btw...  
it accomplishes the same thing, if necessary, by operations on 
associated control files.  A very RESTful and resource-like way to do 
things.)

> I've also had trouble with the use of the word "resource" to mean
> things-themselves (like cars and dogs) instead of files.  But I think
> I've got it: in an OOP system, each object is stored in some bunch of
> memory (contiguously in C/C++, probably spread out in perl/python).
> The thing itself (my dog Taiko) is represented in the computer by some
> OOP "object" at address 0x00f754c0; if we want to talk on the web
> about him, I also give him a URI (http://hawke.org/taiko) and a GET of
> that address will fetch some marshalled form of the data at
> 0x00f754c0.  Does that all sound about right?

Sounds about right.  There are perennial debates even within TAG on 
whether URI must refer to the abstract thing in the computer or to 
Taiko himself;  my opinion, and certain other people's, too, is that 
the URI can refer to anything at all, including the real-world object.  
The implication is that URI do not necessarily have to support being 
dereferenced.  (Think about XML:  we can use URI to refer to schemas, 
but the URI that refers to a schema cannot necessarily be dereferenced 
to obtain a representation of the schema.)

> (the light dawns outside my window, and in my brain....)

Cool!

:-)

Good luck,

jb

>
>     -- sandro
>
> [1] http://www.xent.com/pipermail/fork/2001-August/002801.html

Received on Wednesday, 27 November 2002 13:18:48 UTC