I've got an XML document which may hold one or more entities. For the sake of this example, let's say those entities are cars.
Now, I'm about to create a REST service which accepts the XML file and carries out create, update and delete operations. I thought I'd simply do :
HTTP POST to /service/car : create cars listed in the in XML document
HTTP PUT to /service/car : update cars listed in the in XML document
HTTP DELETE to /service/var : delete cars listed in the in XML document
However, it is my impression that PUT and DELETE should act on resources (URL's) which represents a specific entity. That is, I could invoke a HTTP DELETE against /service/car/10 to delete car number 10. However, the HTTP/1.1 specification states that
The PUT method requests that the enclosed entity be stored under the supplied Request-URI
This means that I can't simply use a PUT to flag an update operation, I should also add the car id to the URL. However, I've got multiple cars which needs to be batch updated.
I'm tempted to do :
HTTP POST to /service/car/create
HTTP POST to /service/car/update
HTTP POST to /service/car/delete
However, something tells me that this isn't quite how you do things with REST.
Are there any "best practise" on this?