httphttp-status-code-404crudhttp-status-codeshttp-delete

What response status codes should I return from an HTTP DELETE endpoint?


What response status codes should I return from an HTTP DELETE endpoint in cases:

In other words, should I treat an attempt to delete absent resource as an error, or should I respond with OK instead?


Solution

  • Ok, there’s always an answer in the RFCs:

    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.