Takeaways
- The server has successfully fulfilled the request and there is no additional content to send in the response payload body.
- Metadata in the response header fields refer to the target resource and its selected representation after the requested action was applied.
- The
204
response allows a server to indicate that the action has been successfully applied to the target resource, while implying that the user agent does not need to traverse away from its current "document view" (if any). - The server assumes that the user agent will provide some indication of the success to its user, in accord with its own interface, and apply any new or updated metadata in the response to its active representation.
- A
204
response is terminated by the first empty line after the header fields because it cannot contain a message body. - A
204
response is cacheable by default; anETag
header is included in such a response.
Information
The 204 No Content
success status response code indicates that a request has succeeded, but that the client doesn't need to navigate away from its current page.
This might be used, for example, when implementing "save and continue editing" functionality for a wiki site. In this case a PUT
request would be used to save the page, and the 204 No Content
response would be sent to indicate that the editor should not be replaced by some other page.
If a 204 status code is received in response to a PUT
request and the response contains an ETag
header field, then the PUT
was successful and the ETag
field-value contains the entity-tag for the new representation of that target resource.