Question

I've been under the impression that Post in Rest means "Create". But after reading up on the spec http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5

It seems like it can be more than just Create? That was also stated by Stormpath in their screencasts on rest api design.

According to Stormpath, Post means "Process" , which can be pretty much anything. Is that the correct way to see it?

I can trigger custom actions for my resources using Post?

Was it helpful?

Solution

In theory, a POST request should attempt to create or modify some resource on the server. As @Tichodroma pointed out, an idempotent request will affect this change only the first time it is sent, but otherwise what's important is that some state on the server will be changed by the request.

More practically. POST requests are often used when the request payload is too large to fit into a GET URI (e.g. a large file upload). This is usually an intentional breach of HTTP standards to avoid a 414 Request-URI Too Long response.

In terms of verbiage, I don't know if I like "process", because even a GET request will usually be "processed" to determine the resource to return. The main difference in my mind is the change of some state on the server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top