HTTP Methods

View saved

Common methods

  • GET — read a resource (safe, no side effects intended)
  • POST — create or trigger an action
  • PUT — replace a resource
  • PATCH — partial update
  • DELETE — remove a resource

Idempotency matters

Repeating an idempotent request should leave the same result. GET, PUT, and DELETE are typically idempotent; POST often is not.

Example flow

Create with POST, read with GET, update with PATCH, remove with DELETE.

POST /api/books
GET /api/books/42
PATCH /api/books/42
DELETE /api/books/42

HEAD and OPTIONS

HEAD is like GET without a body. OPTIONS is used in CORS preflight. You will meet them as you build browser clients.

Comments

One comment per signed-in account. Comments are saved with this page’s URL.