Reputation: 110592
In an API, what HTTP METHOD
should be used for a cancel operation.
I imagine this wouldn't be a DELETE
request, because the resource is not being disposed of. In which case, should it be a POST
or a PUT
? Here is some documentation, but I still am not clear on the distinction from this: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
Upvotes: 8
Views: 7356
Reputation: 24590
This isn't a DELETE. Cancelling an operation is a state change and a state change means an update.
I would personally use a PUT because you normally know the URI of the resource you are updating.
Also see this post for more details: PUT vs POST in REST.
Upvotes: 12