A DELETE with the body is not strictly forbidden , but it is very unusual and is ignored by some frameworks / servers. The need for an entity body may indicate that a DELETE not used because it is intended.
For example: if a GET /customers/4711 returns one client and you send DELETE /customers/4711 , the next GET on this resource should return 404 . You have removed the resource identified by the URL , for example, as defined in the specification .
Your URL /store/remove/from/group does not seem to identify the resource. Using identifiers like /store/4711 or /groups/4711 and sending DELETE to them would not suit your needs, because you want to βremove the repository from the groupβ without deleting the repository or the group.
Assuming you have a group resource
{ "id" : 4711, "stores" : [123, 456, 789] }
and you want a result like
{ "id" : 4711, "stores" : [123, 789] }
you are not deleting anything. You are modifying the resource, so PUT , POST or PATCH are the appropriate methods. JSON-Patch is a good format for describing such changes. The request will look like this:
PATCH /groups/4711 HTTP/1.1 Content-Type: application/json-patch [ { "op" : "remove" "path" : "stores/1" } ]
lefloh
source share