In REST, when trying to delete a resource that has already been deleted , which code should I return?
PS: I generally fluctuate between 404 and 410
In REST, when trying to delete a resource that has already been deleted , which code should I return?
PS: I generally fluctuate between 404 and 410
In general, the essence of REST in idempotency. See the specification . According to the idea it does not matter whether the earlier has been removed already or not.
From RESTful Web Services Cookbook: Solutions for Improving Scalability and Simplicity :
The DELETE method is idempotent. This is a request for the server. But in practice, the implementation of the deleted resources. Otherwise, it can return a 404 (Not Found).
So, it is recommended to return the code 200. But, in some cases it is possible to return 404.
Source: https://ru.stackoverflow.com/questions/583705/
All Articles