This is a single archived entry from Stefan Tilkov’s blog. For more up-to-date content, check out my author page at INNOQ, which has more information about me and also contains a list of published talks, podcasts, and articles. Or you can check out the full archive.

Using POST

Stefan Tilkov,

Tim Bray wrote an interesting post on using POST to initiate an action; interesting comments and an illuminating post by Roy Fielding followed. My favorite comment comes from Andrew Wahbe:

Worrying about the way you've structured the resources on the server is usually a sign that you actually aren't thinking RESTfully. Why? Because you should be worrying if your hypermedia format frees the client from any dependencies on that structure. If you've got that right (and most haven't) then you can worry about using the method with the strongest semantics for each operation (GET for idempotent and safe operations, PUT or DELETE for idempotent and un-safe operations and POST for everything else). That will allow you to tune the plumbing (e.g. caching) as needed. Anything else is a waste of time. Futzing with resource structures doesn't yield practical benefits and doesn't make your system more RESTful (despite popular opinion).

On March 21, 2009 8:04 PM, Jean-Jacques Dubray said:

So Stefan, you mean some resources have actions other than Create, Update, Delete? That’s news to me. I don’t know how many times we debated this question and I was under the impression that the interface to a resource is “uniform”. Specific actions transcoded as POST are still actions and part of the interface of the resources. This is no different at all as the PUT tunnelling via a POST on a uri /…./noun?verb=PUT.

And of course, you still argue that if you arbitrarily change the “action interface” a “client” can adapt without changes, and of course, there is no value in describing this “action interface” with metadata?

On April 2, 2009 5:13 AM, Dilip Krishnan said:

@JJD I believe this in specific reference handling certain ‘non-uniform’ interactions such as POST, for e.g. partial updates to resources, restarting a vm like Tim’s example etc. Conditions where the the “action interface” does not represent a ‘standard’ verb.

I believe that the disconnect that I see is that the POST is to a non-resource-uri, that serves as an action as opposed to further modeling it as an interaction with a resource-uri and using an appropriate verb, which as the comment suggest “doesn’t yield additional benefit nor make the system more RESTful”