Types of HTTP Status code.
Towhidul Islam
AI & Web Innovator | Helping You Grow with Smart MVPs, Chatbots & CRMs | Scalable AI Agents & Custom Websites for Ambitious Brands | Business-Focused Solutions That Drive Success | Software Engineer Book a free meeting.
In server responses, HTTP status codes are used to indicate the outcome of a client's request to the server. These status codes are divided into five main categories, each represented by the first digit of the three-digit code. Here's a breakdown of these categories and some common status codes:
1. 1xx: Informational
These codes indicate that the server has received the request and is continuing to process it.
- 100 Continue: The server has received the initial part of the request and the client should continue sending the rest.
- 101 Switching Protocols: The server is switching protocols as requested by the client.
2. 2xx: Success
These codes indicate that the client's request was successfully received, understood, and accepted.
- 200 OK: The request was successful, and the server has returned the requested resource.
- 201 Created: The request was successful, and a new resource has been created as a result.
- 202 Accepted: The request has been accepted for processing, but the processing has not been completed.
- 204 No Content: The server successfully processed the request, but there is no content to send in the response.
3. 3xx: Redirection
These codes indicate that further action needs to be taken by the client to complete the request.
- 301 Moved Permanently: The requested resource has been permanently moved to a new location.
- 302 Found: The requested resource is temporarily available at a different URI.
领英推荐
- 304 Not Modified: The resource has not been modified since the last request, so the client can use the cached version.
4. 4xx: Client Error
These codes indicate that there was an error in the request sent by the client.
- 400 Bad Request: The server cannot process the request due to a client error (e.g., malformed request syntax).
- 401 Unauthorized: The request requires user authentication.
- 403 Forbidden: The server understands the request but refuses to authorize it.
- 404 Not Found: The requested resource could not be found on the server.
- 405 Method Not Allowed: The request method is not supported for the requested resource.
5. 5xx: Server Error
These codes indicate that the server failed to fulfill a valid request.
- 500 Internal Server Error: A generic error occurred on the server.
- 501 Not Implemented: The server does not recognize the request method, or it lacks the ability to fulfill the request.
- 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 currently unable to handle the request due to temporary overloading or maintenance.
These status codes help communicate the result of the request to the client, providing information on whether the request was successful, requires further action, or encountered errors.