Search code examples
resthttp-status-codes

What status code should server respond with when status of completed asynchronous DELETE operation is requested?


Assume server responds with 202 ACCEPTED to DELETE request and sets Location header to \status\1, where progress can be tracked. While the request is being processed, 200 OK is returned for GET \status\1 with some info in response body. What should server respond when deletion is done? Should it return 404 NOT FOUND or should it return some other code indicating deleting was finished and preserve old statuses?


Solution

  • If you have a separate endpoint for the 'status of the operation', I would probably expect that endpoint to always return 200 OK with more information.

    404 returning from that endpoint doesn't tell me that the original DELETE has succeeded, but it tells me that the 'status itself' is removed.