Overview

Request succeeded, and you don't need to navigate away.

Takeaways

  1. The server has successfully fulfilled the request and there is no additional content to send in the response payload body.
  2. Metadata in the response header fields refer to the target resource and its selected representation after the requested action was applied.
  3. 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).
  4. 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.
  5. A 204 response is terminated by the first empty line after the header fields because it cannot contain a message body.
  6. A 204 response is cacheable by default; an ETag 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.

Further Reading

Specification

204 No Content | The HTTP Working Group

204 No Content

MDN web docs

PUT method

MDN web docs

ETag header field

MDN web docs