I have a question regarding REST API design. Here is a simple (maybe too simple) API:
GET /ecommerce/order/123
POST /ecommerce/order (create a new order)
PUT /ecommerce/order/123 (update an existing order)
DELETE /ecommerce/order/123 (cancel order)
But what if I wanted the customer to enter a reason for an order to be cancelled? I would need to send post data to the API, but that wont work with DELETE. To cater for this the I would have to change DELETE to PUT. I would then post two different resources for update and cancel.
Another solution would be to change the API:
GET /ecommerce/order/123
POST /ecommerce/order/create (create a new order)
PUT /ecommerce/order/update/123 (update an existing order)
DELETE /ecommerce/order/cancel/123 (cancel order)
I'm not sure which is the best option.
There is a more general question about how REST API's handle multiple commands for a single resource.
Any input would be appreciated! I'm going to be reading REST in Practice very soon but this question is niggling away at me.