• Feeds

    Subscribe in a reader

  • Ads

Musings on PUT and POST

I came across Eliotte Rusty Harold's missive PUT is not UPDATE via rest-discuss.

Not gonna lie -- I think that reducing PUT to bitblt() is a pretty limiting view of HTTP.

The essential difference between PUT and POST is that POST allocates a new name while PUT doesn't [1]. Neither verb has anything to say about representation.

But I agree -- the SQL analogy of PUT <-> UPDATE is tired. PUT isn't UPDATE, it's

public virtual Representation ApplyState( Representation state );

For PUT, the request-uri is the "this" pointer. The object behind the "this" pointer can apply the incoming state in whatever way it wants -- including but not limited to a simple bitwise copy of the new state into itself.

Just the opinion of one dude with a blog, naturally.

[1] That's the purist view of POST, of course...

#1 Mark Baker on 3.15.2007 at 9:18 AM

Define "allocates" 8-)

#2 Steve Maine on 3.15.2007 at 10:54 AM

Allocates == remove a name from the set of all names not currently in use.

#3 Alan Dean on 3.21.2007 at 4:09 AM

[manual pingback]http://tech.groups.yahoo.com/group/rest-discuss/message/8151

#4 Mark Baker on 3.24.2007 at 10:10 AM

Define "in use".Less cryptically though, both PUT and POST can allocate names.The difference is that with PUT, the client chooses the name, while with POST the server does.Also, POST doesn't necessarily allocate a name, i.e. not all POST interactions result in a resource being created.

#5 Alex James on 5.03.2007 at 1:46 PM

UPDATE, INSERT whatever, isn't it just that the PUT should be reproducable with a GET?