💡 If you like this website, please share it with your friends and network! 🚀
Back to All Questions
Question 12 of 100
Basic API Testing
Beginner

Q12: What are HTTP Status Codes? List Common Codes.

🔢Core Concept

What are HTTP Status Codes? List Common Codes.

Key Takeaways & Architecture Summary

  • âś“Three-digit integers indicating the structural result of an HTTP request.
  • âś“200 OK (Success), 201 Created (Resource added), 204 No Content.
  • âś“400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found.
  • âś“500 Internal Error, 502 Bad Gateway, 503 Service Unavailable.

Direct Answer Summary

HTTP Status Codes are standardized three-digit integers returned by servers to indicate whether a request succeeded or failed. They are categorized into five ranges: 1xx (Informational), 2xx (Success), 3xx (Redirection), 4xx (Client Errors), and 5xx (Server Errors). Common examples include 200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 403 Forbidden, and 500 Internal Server Error.

⚠️ Senior Engineering Warning (Red Flag)

Never return HTTP 200 OK for requests that failed business logic validation. If a user tries to transfer -$100, the API should return a client error code (e.g. 400 Bad Request), not a 200 with an error string in the body.

đź’ˇ STAR Architectural Explanation & Pro Tip

Status codes allow client libraries to dynamically branch execution pathways. A 4xx code forces the client UI to render user-facing errors, while a 5xx code alerts the engineering team of server issues.

RestAssuredTest.java
Rest-Assured + Java
// Assert status codes in Postman Chai assertions
pm.test("Status is 201 Created", function () {
    pm.response.to.have.status(201);
});