Chapter 2 of 10All chapters
Chapter 2 of 10
The request
Method, path, headers, body.
The four parts
The method says what kind of action, the path says which resource, headers carry metadata such as content type and authentication, and the body carries the data being sent.
- GET reads, POST creates, PUT replaces, PATCH updates part, DELETE removes.
- Query parameters filter and paginate; they are not the place for secrets.
Safe and idempotent
GET should change nothing, so caches and crawlers can repeat it freely. PUT and DELETE are idempotent: doing them twice leaves the same state, which makes retries safe.