REST and Pushback on POST

lol recently I got push-back on POST.

Now that the REST community has accepted POST as the CREATE verb, it seems that’s all it is now (!).

Really, going by the HTTP spec, POST is only the CREATE verb because it’s the “append” verb. What you’re doing with a POST to create is you’re appending an entity to a collection.

This is the same as if you were POSTing to append a line to a logfile resource. Except that you’re posting a whole new entity to a collection of similar entities.

But don’t forget that POST is also declared to be the general data processing verb:

Providing a block of data, such as the result of submitting a form, to a data-handling process

So, for example, if you wanted to do a search with richer data than URL-encoded name/value pairs, the spec suggests that POSTING that data to a search resource should process the data and return the search results.

Or if you have some resource defined and there’s some processing the resource performs, then POST is an appropriate verb under standard HTTP use. The spec doesn’t say that a POST request has to alter any state. It doesn’t have to be idempotent or safe — but it can be.

I always like to say that the Internet — the basis for REST — was built on top of GET and POST. GET a page, then POST data from page inputs for processing. A resource-based application can still take advantage of that without running afoul of the standard usage of the underlying protocol.


1 Comment

Filed under open standards, opinionizing, REST

One response to “REST and Pushback on POST

  1. Pingback: Distributed Weekly 157 — Scott Banwart's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s