DEV Community

deffrin joseph
deffrin joseph

Posted on

There are other http status codes too..!

When my father sees a 404 page on my computer he knows that it is some kind of an error. He usually sees that on his smartphone sometimes when the internet goes off or something else. Even my father doesn't know it is a HTTP status code for Page not found, he knows that 404 is related to that kind of problem someway.

Yes, http status codes are meant to give us detail about the status of http requests.

I came to know more about the usability of this when I started doing API development. The Http status code I was more familiar with are 404, 500, 301, 200 , 403 , etc. I never thought there are lots of other status codes too. But when I started seeing a status code '202 Accepted' in an API response I came to think more about the purpose of it for client-server communication. '202 Accepted' means the request has been accepted and the processing is being done.

We need to think that not all successful(in some sense) requests are '200 OK'. According to the result of a request the status code need to be chosen. Example, for validation errors the status code must be '422 Unprocessable Entity' and when a request fails due to the lack of a payment plan the status code need to be '402 Payment Required'.

Status codes speaks by itself and can thus make api communication more meaningful. Read the wikipedia page for more info. https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Top comments (0)