Course contentsShow
← Computer Science
Lesson 1517 of 2,87235. Application Layer ProtocolsFree lesson

HTTP Methods: PUT, DELETE, and Others

Exploring additional HTTP methods for resource manipulation and their idempotency properties.

HTTP Methods: PUT, DELETE, and Others

You'll learn how HTTP's less common methods enable full CRUD operations and what makes some methods "idempotent."

Beyond GET and POST

While GET retrieves data and POST submits it, HTTP defines several other methods for complete resource manipulation:

PUT — Updates or creates a resource at a specific URL. Think of it like saving a file with a known filename: if the file exists, you overwrite it; if not, you create it. PUT /users/42 with a request body containing user data replaces the entire resource at that location.

DELETE — Removes the resource at the specified URL. DELETE /users/42 tells the server to delete user 42. Simple and direct.

PATCH — Partially updates a resource. Unlike PUT (which replaces the whole thing), PATCH modifies only specific fields. It's like editing one paragraph of a document instead of rewriting the entire page.

HEAD — Identical to GET but returns only headers, no body. Useful for checking if a resource exists or getting metadata without downloading the full content.

OPTIONS — Asks the server which HTTP methods are supported for a given resource. Think of it as asking "What can I do with this URL?"

Idempotency: A Critical Property

An idempotent method produces the same result whether you call it once or multiple times:

  • PUT is idempotent: updating user 42 ten times leaves the same final state
  • DELETE is idempotent: deleting user 42 twice still results in no user 42
  • POST is NOT idempotent: submitting a form twice creates two entries
  • GET, HEAD, OPTIONS are idempotent (reading doesn't change state)

This matters for reliability—if a network error occurs, you can safely retry idempotent requests without worrying about duplicate side effects.

Key Takeaway: PUT, DELETE, PATCH, HEAD, and OPTIONS extend HTTP's capabilities for full resource management, with idempotency properties that determine whether operations can be safely retried.