Junior
What HTTP message or error codes do you know and what do they mean?
sobes.tech AI
Answer from AI
- 1xx Informational: The request has been received, and the process is continuing.
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 understands and is willing to comply with the request to switch protocols as defined in the Upgrade header.
- 2xx Success: The action was successfully received, understood, and accepted.
200 OK: The request was successful.201 Created: The request has been fulfilled, resulting in the creation of a new resource.204 No Content: The request was successfully processed, but no content is returned. Often used for PUT or DELETE requests.
- 3xx Redirection: Further action is needed to complete the request.
301 Moved Permanently: The requested resource has been permanently moved to a new URI. Future requests should use the 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. The client can use its cached version.
- 4xx Client Error: The request contains bad syntax or cannot be fulfilled.
400 Bad Request: The server cannot process the request due to invalid syntax.401 Unauthorized: Authentication is required. The client must authenticate.403 Forbidden: The server understood the request but refuses to authorize it. The client does not have access rights.404 Not Found: The server cannot find the requested resource.405 Method Not Allowed: The request method is not supported for the requested resource.408 Request Timeout: The server did not receive a complete request within the time it was prepared to wait.409 Conflict: The request could not be completed due to a conflict with the current state of the resource.429 Too Many Requests: Too many requests have been made in a given amount of time. Used for rate limiting.
- 5xx Server Error: The server failed to fulfill an apparently valid request.
500 Internal Server Error: An internal server error prevented the request from being fulfilled.501 Not Implemented: The server does not support the functionality required 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 unavailable (e.g., overloaded or down for maintenance).504 Gateway Timeout: The server, acting as a gateway or proxy, did not receive a timely response from the upstream server.
Example code to check status:
# Example using curl to get HTTP status
curl -s -o /dev/null -w "%{http_code}\n" https://www.google.com
Sample table (not to be wrapped in code):
| Code | Category | Meaning |
|---|---|---|
| 200 | Success | OK |
| 404 | Client Error | Not Found |
| 500 | Server Error | Internal Server Error |