What status code should I set for UPDATE
(PUT
) and DELETE
(e.g. product successfully updated)?
HTTP status code for update and delete
httphttp-status-codes
Related Topic
- Rest – What’s an appropriate HTTP status code to return by a REST API service for a validation failure
- Java – How to use java.net.URLConnection to fire and handle HTTP requests
- What HTTP status response code should I use if the request is missing a required parameter
- REST HTTP status codes for failed validation or invalid duplicate
- Rest – HTTP response code for POST when resource already exists
- Java – JAX-RS — How to return JSON and HTTP status code together
- Rest – SOAP vs REST (differences)
- R – Creating a polygon shape from a 2d tile array
Best Answer
For a PUT request: HTTP 200 or HTTP 204 should imply "resource updated successfully".
For a DELETE request: HTTP 200 or HTTP 204 should imply "resource deleted successfully". HTTP 202 can also be returned which would imply that the instruction was accepted by the server and the "resource was marked for deletion".
Source: W3.org: HTTP/1.1 Method Definitions
Source: List of HTTP status codes: 2xx Success