HTTP DELETE request method, delete all the current representations of the target resource given by URI. The HTTP DELETE method is used to delete a resource from the server.

The HTTP DELETE method is often used in REST APIs to delete resources. This method is idempotent, which means that multiple identical requests will have the same effect as a single request.

Syntax

DELETE /demo.html HTTP/1.1

Example

Here is an example of an HTTP DELETE request:

Request

DELETE /demo.html HTTP/1.1
Host: apitier.com
Content-type: text/html
Content-length: 30

<h1>APITier</h1>
<p>Highly Scalable API Platform</p>

Response

If a DELETE method is successfully applied, there are several response status codes possible:

202 – Accepted

Indicates that the request has been received but not completed yet. It is typically used in log running requests and batch processing.

202 – No Content

The server has fulfilled the request but does not need to return a response body. The server may return the updated meta information.

200 -OK

Indicates that the request has succeeded.

HTTP/1.1 200 OK
Content-type: text/html
Content-length: 30
Date: Mon, 14 Nov 2022 08:18:00 GMT

<html>
  <body>
    <h1>Demo File deleted.</h1>
  </body>
</html>

Specification

SafeNo
IdempotentYes
CacheableNo
Can have a bodyYes

Get more information about HTTP Status Codes