Skip to content
BENIBIX Learn

DELETE Request

Infrastructure🌐 NetworkingRequests and Responses

Also known as DELETE, HTTP DELETE, DELETE Method

The web request that wipes out the thing at an address.

Think of it like

Think of it like asking a shop to take one thing off the shelf.

Example

Jack deletes an old blog post. His app sends DELETE /api/posts/17, and the server answers 204.

Why it matters

With a clear delete method, servers can check who may remove what. It also keeps deletes out of GET links.

Definition

A DELETE request asks the server to remove a thing at a given address. Most DELETE requests have no body; the address says what to remove. Sending it twice has the same result as once, because the thing is already gone. Servers usually answer 204 No Content, or 404 Not Found the second time. Many apps hide the record instead of erasing it, so it can be brought back.

Example code

http
DELETE /api/posts/17 HTTP/1.1
Host: example.com
The address alone says which post to remove.

Common mistake

Letting anyone who knows the address send a DELETE. Always check the user may remove that thing.

Key takeaways

  1. 1
    Removes a thing. Named by the address.
  2. 2
    Usually no body. The address is enough.
  3. 3
    Same result twice. It is already gone.

Learn it properly