DELETE request method
The
DELETE HTTP method asks the server to delete a specified resource.The
DELETE method has no defined semantics for the message body, so this should be empty.| Request has body | May |
|---|---|
| Successful response has body | May |
| Safe | No |
| Idempotent | Yes |
| Cacheable | No |
| Allowed in HTML forms | No |
Syntax
<request-target>-
Identifies the target resource of the request when combined with the information provided in the
Hostheader. 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 ofkey=valuepairs.
Examples
Successfully deleting a resource
The following request asks the server to delete the resource
file.html:If the request is successful, there are several possible successful 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:A
200 OK response means the request was successful and the response body includes a representation describing the outcome: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.Specifications
| Specification |
|---|
| HTTP Semantics # name-delete (external) |
Browser compatibility
The browser doesn't use the
DELETE method for user-initiated actions, so "browser compatibility" doesn't apply.
Developers can set this request method using fetch().See also
- HTTP statuses:
200,202,204 - HTTP request methods
- HTTP response status codes
- HTTP headers
