API Testing
HTTP Status Codes
Three-digit codes returned by servers indicating the result of an HTTP request (200 = OK, 404 = Not Found, etc.).
Full definition
HTTP status codes are three-digit numbers returned by web servers indicating the outcome of a request. QA engineers must know these for API testing and debugging.
1xx — Informational:
- 100 Continue
- 101 Switching Protocols
2xx — Success:
- 200 OK — Request succeeded
- 201 Created — New resource created (POST)
- 204 No Content — Success, no body (DELETE)
3xx — Redirection:
- 301 Moved Permanently — URL changed permanently
- 302 Found — Temporary redirect
- 304 Not Modified — Cached version is still valid
4xx — Client Error:
- 400 Bad Request — Invalid request syntax/data
- 401 Unauthorized — Authentication required
- 403 Forbidden — Authenticated but not authorized
- 404 Not Found — Resource doesn't exist
- 405 Method Not Allowed — Wrong HTTP method
- 409 Conflict — Request conflicts with current state
- 422 Unprocessable Entity — Validation failed
- 429 Too Many Requests — Rate limited
5xx — Server Error:
- 500 Internal Server Error — Generic server failure
- 502 Bad Gateway — Upstream server error
- 503 Service Unavailable — Server overloaded/maintenance
- 504 Gateway Timeout — Upstream server timeout
Key for API testing: always verify the correct status code, not just the response body.