Sending HTTP DELETE Request

The HTTP DELETE request is used to delete a resource from the server. The HTTP DELETE request, like an HTTP GET and HEAD, should not contain a body, as some servers may reject such requests, but you can still send data to the server in the URL parameters of the DELETE request. In this HTTP DELETE request example, we send a DELETE request to the ReqBin echo URL to remove a resource from the server. The Accept: */* request header tells the server that the client accepts all media types. The Content-Type server response header indicates the MIME type of the returned data. Click Send to execute the DELETE Request example online and see the results.
Sending HTTP DELETE Request Send
DELETE /echo/delete/json HTTP/1.1
Accept: */*
Authorization: Bearer mt0dgHmLJMVQhvjpNXDyA83vA_PxH23Y

Updated: Viewed: 44142 times

What is HTTP?

HTTP (Hypertext Transfer Protocol) is a network communication protocol widely used to transfer data between an HTTP client (browser or mobile application) and the server. The HTTP protocol assumes the use of a client-server architecture for data transfer. The client application sends the request to the server, and the server processes the client's request and sends a response back to the client. Some server responses may contain data in the body of the server response (for example, an HTML page), and some may only have headers and an empty body. Each HTTP message consists of a request string, HTTP headers, and a message body.

What is the HTTP DELETE request method?

HTTP DELETE request allow the deletion of a resource from the server. The HTTP DELETE method should not contain a body, as sending a body in a DELETE request may cause some servers to reject it. The DELETE method is defined as idempotent, which means that multiple, identical DELETE requests should have the same impact on the server as a single request.

What are the common HTTP DELETE response codes?

HTTP response status codes indicate the status of a completed request. When the server has successfully processed a DELETE request, it can respond with several response status codes:

  • 200 (OK) - the action completed successfully. The server response may have a message body.
  • 204 (No Content) - the action completed successfully. The server response does not have a message body.
  • 202 (Accepted) - the action is likely to be successful but not yet complete.

HTTP DELETE Request Example

The following is an example of sending an HTTP DELETE request to a ReqBin echo URL:

HTTP DELETE Request Sample
DELETE /echo/delete/json HTTP/1.1
Authorization: Bearer {token}
Accept: */*

The server's response to our HTTP DELETE request:

HTTP DELETE Response Example
HTTP/1.1 200 OK
Content-Length: 19
Content-Type: application/json


See also

Generate Code Snippets for DELETE Request Example

Convert your DELETE Request request to the PHP, JavaScript/AJAX, Node.js, Curl/Bash, Python, Java, C#/.NET code snippets using the ReqBin code generator.