A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

DELETE Method

About1

The DELETE HTTP method (HTTP verb) asks the server to delete a specified resource. It has no defined semantics for the message body, so this should be empty. Also known as DELETE request.

Characteristics

Request has bodySuccessful response has bodySafeIdempotentCacheableAllowed in HTML forms
MayMayNoYesNoNo

Syntax

DELETE <request-target>["?"<query>] HTTP/1.1
  • <request-target>: identifies the target resource of the request when combined with the information provided in the

Host header. This is an absolute path (e.g. /path/to/file.html) in requests to an origin server, and an absolute URL in requests to proxies (e.g. http://www.example.com/path/to/file.html)

  • <query> (Optional) - an optional query component preceded by a question-mark ?. Often used to carry identifying

information in the form of key=value pairs.

Examples

Successfully deleting a resource

The following request asks the server to delete the resource file.html:

DELETE /file.html HTTP/1.1
Host: example.com

If the request is successful, there are several possible success response status codes. A 204 No Content response means the request was successful and no additional information needs to be sent back to the client:

HTTP/1.1 204 No Content
Date: Tue, 06 May 2025 22:19 GMT

A 200 OK response means the request was successful and the response body includes a representation describing the outcome:

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Date: Tue, 06 May 2025 22:22 GMT
Content-Length: 1234

<html>
  <body>
    <h1>File "file.html" deleted.</h1>
  </body>
</html>

A 202 Accepted response means the request has been accepted and will probably succeed, but the resource has not yet been deleted by the server:

HTTP/1.1 202 Accepted
Content-Type: text/html; charset=UTF-8
Date: Tue, 06 May 2025 22:23 GMT
Content-Length: 1234

<html>
  <body>
    <h1>Deletion of "file.html" accepted.</h1>
    <p>See <a href="http://example.com/tasks/123/status">the status monitor</a> for details.</p>
  </body>
</html>

Anki

References


  1. MDN. “DELETE method”. Available at: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/DELETE. (Accessed: [2025-05-06 Tue 22:12]). ↩︎

Related Posts