HTTP Methods Overview
| Method | Purpose | Body? | Idempotent? | Safe? |
|---|---|---|---|---|
GET | Read/retrieve resource | No | Yes | Yes |
POST | Create new resource | Yes | No | No |
PUT | Replace entire resource | Yes | Yes | No |
PATCH | Partial update | Yes | No | No |
DELETE | Remove resource | Optional | Yes | No |
HEAD | Like GET but no body | No | Yes | Yes |
OPTIONS | Discover allowed methods | No | Yes | Yes |
REST API Design Patterns
| Operation | Method | URL | Response |
|---|---|---|---|
| List users | GET | /api/users | 200 + array |
| Get user | GET | /api/users/123 | 200 + object |
| Create user | POST | /api/users | 201 + object |
| Update user | PUT | /api/users/123 | 200 + object |
| Partial update | PATCH | /api/users/123 | 200 + object |
| Delete user | DELETE | /api/users/123 | 204 (no content) |
Content Types
| Type | Header |
|---|---|
| JSON | Content-Type: application/json |
| Form data | Content-Type: application/x-www-form-urlencoded |
| File upload | Content-Type: multipart/form-data |
| Plain text | Content-Type: text/plain |
Common Headers
| Header | Purpose |
|---|---|
Authorization: Bearer <token> | Authentication |
Accept: application/json | Expected response format |
Cache-Control: no-cache | Caching behavior |
X-Request-ID: uuid | Request tracing |