In my API, resources can be write-protected. Trying to DELETE such a resource will return a 409 (Conflict) response.
For users that are allowed to change the protected state of a resource, I want to introduce the option to delete protected resources with one request. How should this option be passed?
Possible solutions:
- Request body -- should not be used with delete requests
- Query parameter -- changes the URI, so technically refers to a different resource
- Custom header -- generally discouraged
- Standard header -- none apply
- Two requests -- not atomic, things could happen in-between (eg another user modifying the resource)
- Alternative endpoint -- not restful?
Related Questions
- In REST API, can DELETE methods have parameters?
- Answer says yes to query parameters, but asks about deleting a subset of a collection
- REST, HTTP DELETE and parameters
- Asks about a confirmation flag, answers say it should be handled in UI instead of API
- Also says it violates the uniform interface principle, but doesn't explain why and how
- Also argues that using query parameters would violate URI principle
- RESTful Alternatives to DELETE Request Body
- Accepted answer says to use the body, but many commenters report technical issues
- Query parameters are suggested as alternative, concern about URI principle is raised
- Is an entity body allowed for an HTTP DELETE request?
- Says not to use the request body, even if technically allowed
- Whats the best way to design DELETE for a restful resource
- Says to use query parameters, but again in a subset context