The protocol underneath.
WHAT A REQUEST CONTAINS
A method A path Headers Sometimes a body
WHAT A RESPONSE CONTAINS
A status code Headers Usually a body
WHAT THE METHODS MEAN BY CONVENTION
- Get: retrieve, changing nothing
- Post: create, or perform an action
- Put: replace entirely
- Patch: modify part
- Delete: remove
WHY CONVENTION RATHER THAN RULE
Nothing enforces it, and plenty of interfaces ignore it.
WHY FOLLOWING IT STILL MATTERS
Caches, proxies and clients behave according to it.
WHAT SAFE MEANS
The request does not change anything.
WHAT IDEMPOTENT MEANS
Repeating it produces the same result as doing it once.
WHICH METHODS ARE WHICH
Get is safe and idempotent Put and delete are idempotent but not safe Post is neither
WHY THAT MATTERS ENORMOUSLY
It determines whether a retry is safe after a timeout.
WHAT HEADERS CARRY
Authentication Content type Caching instructions Anything not part of the data itself
WHAT THE BODY CARRIES
The data.
WHAT TO NEVER PUT IN A PATH OR QUERY
Passwords, tokens or personal data.
WHY
They appear in logs, proxies and browser history.