Looks like you have misunderstood the content of the link you posted.
The DELETE
HTTP method can be used to remove a single resource or a collection of resources.
However, in most of situations, you don't want to allow the client to remove the entire collection, so you return a 405
status code indicating that the DELETE
method is not allowed in the collection URL.
In more practical terms, consider that you have a collection of customers mapped to /customers
.
A GET
request to such URL will return a representation of this collection. A DELETE
request to such URL will delete all customers from your application. It's very likely you don't want that, so you return 405
to indicate that deleting all customers at once is not allowed. In the other hand, you want to allow the client to delete a single customer by performing a DELETE
request to a URL that locates a single customer, such as /customers/{id}
.
If the request succeeds, consider one of the following status codes, as defined in the RFC 7231:
If a DELETE
method is successfully applied, the origin server SHOULD
send a 202
(Accepted) status code if the action will likely succeed
but has not yet been enacted, a 204
(No Content) status code if the
action has been enacted and no further information is to be supplied,
or a 200
(OK) status code if the action has been enacted and the
response message includes a representation describing the status.