Samuel Wanjare
Tu Nov 08, 2022HTTP is a protocol for fetching resources such as HTML documents. It is the foundation of any data exchange on the Web and it is a client-server protocol, which means requests are initiated by the recipient, usually the Web browser. A complete document is reconstructed from the different sub-documents fetched, for instance, text, layout description, images, videos, scripts, and more.
HTTP response status codes indicate whether a specific request has been successfully completed.
1. Informational Responses (100 - 199)
2. Successful Responses (200 - 299)
3. Redirection Responses (300 - 399)
4. Client Error Responses (400 - 499)
5. Server Error Responses (500 - 599)
Of the 5 classes above, each class at least has about 100 status codes but today we will only discuss the ten most common HTTPP response status codes.
The standard OK status code means that an http request was successful and the resource was delivered. Resource here being anything that you're trying to send over the internet.
The request succeeded. The result meaning of "success" depends on the HTTP method:
GET: The resource has been fetched and transmitted in the message body.
HEAD: The representation headers are included in the response without any message body.
PUT or 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.
The request succeeded, and a new resource was created as a result. This is typically the response sent after
POST
requests, or somePUT
requests.The request was successful but no new information needed to be returned. This is typical of DELETE requests.
The requested resource has been permanently moved to a new URL indicated in the Location response header.
This is used for caching purposes. It tells the client that the response has not been modified, so the client can continue to use the same cached version of the response.
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).
The client cannot access the resource because they are not authenticated.
The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource.Unlike
401 Unauthorized
, the client's identity is known to the server.The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of
403 Forbidden
to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web.The request is valid, but there is an unexpected and unknown server-side problem and the request cannot be completed.
Source: Mozilla Developer Network MDN
If you reached this far, thank you for reading, I hope I helped and have a wonderful time.