Ch. 20 · Networking

HTTP Methods, Safety and Idempotence

HTTP Methods, Safety and Idempotence. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readbeginnerupdated Oct 3, 2026

Method semantics tell clients how operations should behave. Safe methods should not request state changes; idempotent operations have the same intended effect when repeated.

Before you start

You should understand clients, servers, IP addresses and ports. Follow a request through name resolution, connection establishment and application exchange. Distinguish protocol guarantees from deployment policy, and use observations from the relevant layer rather than guessing from one browser error message.

The practical goal is to reason through this situation: PUT can replace one resource repeatedly, while POST may create new operations. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Separate safety and repetition

Safe concerns requested state changes; idempotent concerns repeated intended effects.

Step 2: Read actual operation meaning

A method name alone cannot guarantee a correctly implemented contract.

Step 3: Choose retry policy

Uncertain mutations need stable identity or outcome reconciliation.

Worked scenario

PUT can replace one resource repeatedly, while POST may create new operations.

Repeated PUT replacing one resource can have the same intended stored result even if responses or audit logs differ. Repeated POST creating orders may create several orders unless the server implements idempotency. GET that triggers a purchase violates safe semantics and can be activated by ordinary link-handling behavior.

Common mistake

Idempotence does not mean identical responses or no logging side effects.

Verify the behavior

Repeat requests and inspect business state, not only identical response text.

Interview exercise

Choose a retry policy.

Answer and reasoning

Consider method semantics and the actual server contract, using operation identity for mutations whose outcome can be uncertain.

Continue learning

Compare the scenario with the Networking interview questions and test your understanding with the Networking MCQs. For terminology and implementation details, consult the reference material.

More in Networking

read ✓Networking · mid

Networking: HTTP Redirects

Choose between 301, 302, 307 and 308, know which preserve the request method, and avoid caching and loop mistakes.

~2 min readread →
read ✓Networking · mid

HTTP Cache-Control and Response Freshness

HTTP Cache-Control and Response Freshness. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readread →
read ✓Networking · mid

HTTP Cookies, Scope and Browser Delivery

HTTP Cookies, Scope and Browser Delivery. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readread →
esc