Answer
HTTP Status Code Categories
| Range | Category | Meaning |
|---|---|---|
| 1xx | Informational | Request was received, continuing process |
| 2xx | Successful | Request was successfully received, understood, and accepted |
| 3xx | Redirection | Further action needs to be taken to complete the request |
| 4xx | Client Error | Request contains bad syntax or cannot be fulfilled |
| 5xx | Server Error | Server failed to fulfil an apparently valid request |
Most Common Status Codes in API Projects
| Code | Name | When You See It |
|---|---|---|
| 200 | OK | Successful GET or PUT request |
| 201 | Created | Successful POST — resource created |
| 204 | No Content | Successful DELETE — nothing to return |
| 302 | Redirect | Resource temporarily moved |
| 400 | Bad Request | Missing/invalid request parameters |
| 401 | Unauthorized | Missing or invalid authentication token |
| 403 | Forbidden | Authenticated but lacks permission |
| 404 | Not Found | Resource does not exist |
| 405 | Method Not Allowed | HTTP method not supported for that endpoint |
| 417 | Expectation Failed | Server cannot meet the Expect header requirement |
| 422 | Unprocessable Entity | Validation failed on request body |
| 500 | Internal Server Error | Server crashed or encountered an unexpected error |
Tips for Testers
- ✓Always verify the correct status code, not just 200
- ✓Test both happy path (2xx) and error paths (4xx, 5xx)
- ✓Use
assertEquals(response.getStatusCode(), 200)in Rest Assured
