HTTP STATUS CODES SIMPLIFIED!!
Samuel Wanjare

Samuel Wanjare

Picture of the authorTu Nov 08, 2022

HTTP STATUS CODES SIMPLIFIED!!

10 HTTP Status codes every developer should familiarize themselves with.

But before we begin, What is HTTP?

HTTP 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.

How about HTTP status codes?

HTTP response status codes indicate whether a specific request has been successfully completed.

Responses are grouped in five classes:

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.

200 OK

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.

201 Created

The request succeeded, and a new resource was created as a result. This is typically the response sent after

POST

requests, or some

PUT

requests.

204 No Content

The request was successful but no new information needed to be returned. This is typical of DELETE requests.

301 Permanently Moved/Redirected

The requested resource has been permanently moved to a new URL indicated in the Location response header.

304 Not Modified

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.

400 Bad Requests

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).

401 Unauthorized

The client cannot access the resource because they are not authenticated.

403 Forbidden

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.

403 Not Found

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.

500 Internal Server Error

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.

Samuel Wanjare

Samuel Wanjare

Python/ JavaScript developer. Football, Computers and Travelling to meet new faces is all that is all I do.

Member since Tu Nov 08, 2022

Leave a reply

No comment(s) yet...

Related Posts

Categories