← Lessons

quiz vs the machine

Silver1120

Networking

HTTP Request Methods Semantics

What GET, POST, PUT, PATCH, and DELETE promise about safety and idempotency.

4 min read · intro · beat Silver to climb

Verbs carry meaning

HTTP methods describe the intent of a request. GET reads, POST creates or triggers, PUT replaces, PATCH partially updates, and DELETE removes. Servers and intermediaries rely on these meanings to cache, retry, and prefetch safely.

Two key properties

  • A method is safe if it does not change server state. GET and HEAD are safe, so crawlers may follow them freely.
  • A method is idempotent if repeating it has the same effect as doing it once. GET, PUT, and DELETE are idempotent, while POST is not.

Idempotency matters because networks drop responses. A client that times out can safely resend a PUT but must be careful resending a POST, which might create a duplicate.

Practical guidance

Use the verb that matches the effect rather than tunneling everything through POST. RESTful APIs lean on these semantics so generic tooling can reason about requests without knowing the application.

Key idea

HTTP methods encode intent through safety and idempotency, letting clients retry GET, PUT, and DELETE but treat POST with care.

Check yourself

Answer to earn rating on the learn ladder.

1. Which method is safe, meaning it does not change server state?

2. Why is POST not safe to blindly retry after a timeout?