Hi There 👋, I’m Victor Nizeyimana, let’s talk about 🚀 HTTP Status Codes.
HTTP Status Codes — Status codes are issued by a server in response to a client’s request made to the server. My favorite status code is: “418: I’m a teapot.” This is not a joke! Maybe… check the RFC2324 Section 2.3.2.
If you love to know all the status codes? Here is the list!
4×× Client Error
5×× Server Error
Easy to remember? Let’s examine the list of status codes…
- Status code: 100 Continue
The initial part of a request has been received and has not yet been rejected by the server. The server intends to send a final response after the request has been fully received and acted upon.
Source: RFC7231 Section 6.1.1
- Status code: 101 Switching Protocol
The server understands and is willing to comply with the client’s request, via the Upgrade header field1, for a change in the application protocol being used on this connection.
Source: RFC7231 Section 6.2.2
- Status code: 200 OK
The payload sent in a 200 response depends on the request method. For the methods defined by this specification, the intended meaning of the payload can be summarized as:
GET: The resource has been fetched and is transmitted in the message body.
HEAD: The entity headers are in the message body.
POST: The resource describing the result of the action is transmitted in the message body.
TRACE: The message body contains the request message as received by the server
- Status code: 201 Created
The request has been fulfilled and has resulted in one or more new resources being created. The 201 response payload typically describes and links to the resource(s) created.
- Status code: 202 Accepted
The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.
- Status code: 203 Non-Authoritative Information
The request was successful but the enclosed payload has been modified from that of the origin server’s 200 OK response by a transforming proxy.
This status code allows the proxy to notify recipients when a transformation has been applied since that knowledge might impact later decisions regarding the content.
- Status code: 204 No Content
The server has successfully fulfilled the request and that there is no additional content to send in the response payload body.
For example, if a 204 status code is received in response to a PUT request and the response contains an ETag header field, then the PUT was successful and the ETag field-value contains the entity-tag for the new representation of that target resource.
- Status code: 205 Reset Content
The server has fulfilled the request and desires that the user agent reset the “document view”, which caused the request to be sent, to its original state as received from the origin server.
- Status code: 206 Partial Content
This response code is used because of range header sent by the client to separate download into multiple streams
- Status code: 300 Multiple Choice
The target resource has more than one representation, each with its own more specific identifier, and information about the alternatives is being provided so that the user (or user agent) can select a preferred representation by redirecting its request to one or more of those identifiers.
- Status code: 301 Moved Permanently
The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs.
A 301 response is cacheable by default i.e. unless otherwise indicated by the method definition or explicit cache controls
- Status code: 302 Found
This response code means that URI of the requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.
- Status code: 303 See Other
Server sent this response to directing the client to get requested resource to another URI with a GET request.
- Status code: 304 Not Modified
A conditional GET or HEAD request has been received and would have resulted in a 200 OK response if it were not for the fact that the condition evaluated to false.
- Status code: 305 Use Proxy
This means requested response is now deprecated and must be accessed by a proxy. This response code is not largely supported because of security reasons.
- Status code: 306 unused
This response code is no longer used, it is just reserved currently. It was used in a previous version of the HTTP 1.1 specification.
- Status code: 307 Temporary Redirect
The target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI.
This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.
- Status code: 308 Permanent Redirect
This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header.
This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.
Client error responses
- Status code: 400 Bad Request
The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
- Status code: 401 Unauthorized
Authentication is needed to get a requested response. This is similar to 403, but in this case, authentication is possible.
- Status code: 402 Payment Required
This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently.
- Status code: 403 Forbidden
The server understood the request but refuses to authorize it. It means the client does not have access rights to the content so the server is rejecting to give a proper response.
- Status code: 404 Not Found
The server can not find the requested resource. This response code probably is the most famous one due to its frequency to occur in the web.
- Status code: 405 Method Not Allowed
The method received in the request-line is known by the origin server but not supported by the target resource.
- Status code: 406 Not Acceptable
This response is sent when the web server, after performing server-driven content negotiation, doesn’t find any content following the criteria is given by the user agent.
- Status code: 407 Proxy Authentication Required
Similar to 401 Unauthorized, but it indicates that the client needs to authenticate itself in order to use a proxy.
- Status code: 408 Request Timeout
The server did not receive a complete request message within the time that it was prepared to wait.
- Status code: 409 Conflict
The request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request.
- Status code: 410 Gone
This response would be sent when requested content has been removed from the server and that this condition is likely to be permanent. If the origin server does not know or has no facility to determine, whether or not the condition is permanent, the status code 404 Not Found ought to be used instead.
- Status code: 411 Length Required
Server rejected the request because the Content-Length header field is not defined and the server requires it.
- Status code: 412 Precondition Failed
This response code allows the client to place preconditions on the current resource state (its current representations and metadata) and, thus, prevent the request method from being applied if the target resource is in an unexpected state.
- Status code: 413 Payload Too Large
The server is refusing to process a request because the request payload is larger than the server is willing or able to process.
- Status code: 414 URI Too Long
If the server refusing the request because the URI requested by the client is longer than the server is willing to interpret.
- Status code: 415 Unsupported Media Type
The media format of the requested data is not supported by the server, so the server is rejecting the request.
- Status code: 416 Requested Range Not Satisfiable
The range specified by the Range header field in the request can’t be fulfilled; it’s possible that the range is outside the size of the target URI’s data.
- Status code: 417 Expectation Failed
This response code means the expectation indicated by the Expect request-header field can’t be met by the server.
- Status code: 421 Misdirected Request
The request was directed at a server that is not able to produce a response. This can be sent by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request URI.
- Status code: 426 Upgrade Required
The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.
- Status code: 428 Precondition Required
The origin server requires the request to be conditional.
- Status code: 429 Too Many Requests
This code is generated when the client sent too many requests in a given amount of time.
- Status code: 431 Request Header Fields Too Large
The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields.
- Status code: 451 Unavailable For Legal Reasons
The user requests an illegal resource, such as a web page censored by a government.
Server error responses
- Status code: 500 Internal Server Error
The server encountered an unexpected condition when it doesn’t know how to handle and prevented it from fulfilling the request.
- Status code: 501 Not Implemented
The server does not support the functionality required to fulfill the request.
- Status code: 502 Bad Gateway
This error response means that the server while working as a gateway to get a response needed to handle the request, got an invalid response.
- Status code: 503 Service Unavailable
The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.
- Status code: 504 Gateway Timeout
The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.
- Status code: 505 HTTP Version Not Supported
The server does not support or refuses to support, the major version of HTTP that was used in the request message.
- Status code: 506 Variant Also Negotiates
The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself and is therefore not a proper end point in the negotiation process.
- Status code: 507 Insufficient Storage
The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. This condition is considered to be temporary.
- Status code: 511 Network Authentication Required
The 511 status code indicates that the client needs to authenticate to gain network access.