Should I return a 410 Gone in response to a successful HTTP DELETE request?

3.2k views Asked by At

I'm implementing DELETE support on a ReST API (build on ServiceStack) and wondering what response code to return following a successful DELETE.

HTTP defines 410 as:

The requested resource is no longer available at the server and no forwarding address is known. This condition is expected to be considered permanent. Clients with link editing capabilities SHOULD delete references to the Request-URI after user approval. If the server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) SHOULD be used instead. This response is cacheable unless indicated otherwise.

Now, if a resource has just been DELETEd, I probably do want many of those recommendations to apply... but accepted practice seems to be returning a 200 OK following a successful DELETE - especially since the 4XX range is supposed to denote error conditions.

Any compelling arguments one way or another beyond the guidelines in the HTTP spec?

1

There are 1 answers

0
Remy Lebeau On BEST ANSWER

RFC 2616 Section 9.7 specifically states the following regarding the response for DELETE:

A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity.