204 No Content
The HTTP204 No Contentsuccessful response status code indicates that a request has succeeded, but the client doesn't need to navigate away from its current page.A204 response is cacheable by default, and anETag header is included in such cases.
A204 No Content in response to these request methods has the following meaning and results:
DELETE: The action was successful, and no further information needs to be supplied.PUT: The action was successful, and theETagvalue contains the entity tag for the new representation of that target resource.
A204 response can be used when implementing "save and continue editing" functionality for applications like wiki sites.In this case, aPUT request could be used to save the page contents, and a204 No Content response indicates to the browser that the editor should not be replaced by other content.
Note that the response must not include any content or theContent-Length header (browsers may reject responses that include content).
In this article
Status
204 No ContentExamples
>Receiving a response after deleting an image
In this example, the client sends a request to delete an image using theDELETE method.The request includes anAuthorization header with a token to authenticate the request:
DELETE /image/123 HTTP/1.1Host: example.comAuthorization: Bearer 1234abcdAfter successfully deleting the image, the server responds with a204 response with no body, indicating no further information needs to be sent to the client.
HTTP/1.1 204 No ContentDate: Wed, 26 Jun 2024 12:00:00 GMTServer: Apache/2.4.1 (Unix)Receiving a response after updating with PUT
In this example, the client sends aPUT request to update a user's profile information.The request includes anAuthorization header with a token to authenticate the request:
PUT /users/123 HTTP/1.1Host: example.comContent-Type: application/jsonAuthorization: Bearer 1234abcd{ "name": "Jane Doe", "email": "jane@example.com"}After successfully updating the user profile, the server responds with a204 response.TheETag header contains the entity tag for the updated resource:
HTTP/1.1 204 No ContentDate: Wed, 26 Jun 2024 12:00:00 GMTETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"Server: Apache/2.4.1 (Unix)Specifications
| Specification |
|---|
| HTTP Semantics> # status.204> |