- What makes a method idempotent?
- Calling an idempotent method multiple times produces the same result as calling it once. GET, PUT, DELETE, HEAD, and OPTIONS are idempotent. POST is not — calling POST twice creates two resources.
- What's the difference between safe and idempotent?
- Safe methods don't change server state (GET, HEAD, OPTIONS). Idempotent methods can be repeated without additional effect (GET, PUT, DELETE). A method can be idempotent without being safe (DELETE changes state but is idempotent).
- When should I use PATCH instead of PUT?
- PATCH when you're sending only the fields to update. PUT when you're sending the complete resource representation. A PUT with missing fields should clear those fields; a PATCH only updates what's provided.