← REST API Development learning pathREST API Development · Module 5 of 10
Request and response formats
Structure JSON bodies, headers and error responses.
📖 Key ideas
- Send JSON with Content-Type: application/json.
- Accept header tells the server what the client wants.
- Use consistent error bodies: { "error": { "code", "message" } }.
- Dates in ISO 8601: 2026-10-14T10:30:00Z.
- Never return passwords or secrets.
💡 Real-life example: Headers are the envelope; the body is the letter inside.
Content-TypeFormat of the body sent
AcceptFormat the client wants back
ISO 8601Standard date-time format
Error bodyJSON explaining what went wrong