Glossary: Building APIs with FastAPI
HTTP status codes
Also written: Status code, status codes, 200, 201, 204, 307, 401, 403, 404, 405, 409, 422, 500, redirect, Unprocessable Entity
A response's three-digit result: 2xx means success, 4xx a client mistake, 5xx a server bug. Common ones: 200 OK (success), 201 Created (after a POST), 204 No Content (after a DELETE), 307 Temporary Redirect (sent to the `location` header's URL, e.g. for a trailing slash), 401 Unauthorized (who are you?), 403 Forbidden (known, but not allowed), 404 Not Found (no such thing), 405 Method Not Allowed (path exists, wrong method), 409 Conflict (valid but clashes with stored data), 422 Unprocessable Content (data failed validation) and 500 Internal Server Error (a bug in your code).
Where the book teaches it
- Chapter 1: How web APIs work
- Chapter 2: Your first API
- Chapter 3: Path and query parameters
- Chapter 4: Request bodies and validation
- Chapter 5: Responses, status codes and errors
- Chapter 6: Dependencies and routers
- Chapter 7: Storing data with SQLModel
- Chapter 8: Authentication
- Chapter 9: Testing your API
- Chapter 11: Project: the Kettle & Crane orders API