Sobes.tech
Junior

What HTTP status codes exist and how are they grouped?

sobes.tech AI

Answer from AI

HTTP status codes are three-digit numbers returned by the server in response to a client's request. They indicate whether the request was successful or if an error occurred.

Grouping of status codes is based on the first digit:

  • 1xx (Informational): The request has been received, and the process is continuing.
    • 100 Continue: The server has received the request headers, and the client should continue sending the request body.
    • 101 Switching Protocols: The server agrees to the client's request to switch protocols.
  • 2xx (Successful): The request was successfully processed.
    • 200 OK: Standard response for successful HTTP requests.
    • 201 Created: The request was successful, and a new resource was created as a result.
    • 204 No Content: The request was successful, but there is no content to send in the response.
  • 3xx (Redirection): Further action is needed to complete the request.
    • 301 Moved Permanently: The requested resource has been permanently moved to a new URI.
    • 302 Found: The requested resource is temporarily located at a different URI.
    • 304 Not Modified: The resource has not been modified since the last request.
  • 4xx (Client Error): The request contains an error from the client.
    • 400 Bad Request: The server cannot process the request due to invalid syntax.
    • 401 Unauthorized: Authentication is required to access the resource.
    • 403 Forbidden: The server understood the request but refuses to authorize it.
    • 404 Not Found: The requested resource was not found on the server.
  • 5xx (Server Error): The server failed to fulfill a valid request.
    • 500 Internal Server Error: An internal server error occurred.
    • 502 Bad Gateway: The server, acting as a gateway or proxy, received an invalid response from the upstream server.
    • 503 Service Unavailable: The server is temporarily unable to handle the request.

The most commonly used for testing are: 200, 201, 204, 301, 302, 304, 400, 401, 403, 404, 500, 503.

What HTTP status codes exist and how are they… - sobes.tech