For every developer out there, learning HTTP status codes are a "struggle" they have to face at some point in their career. HTTP status codes may seem a bit difficult to learn and remember at first, but they are very important, and super helpful actually. As you advance in your developing career you will fall in love with HTTP status codes especially those "bad" ones, for the simple fact that they tell you exactly what's wrong with your code and where to start debugging.

In this series of articles we will go through each of them in details to help you better understand these status codes and begin to put them in good use instead of stressing over why you have to learn them.

How do we categorize HTTP status codes?

  • Informational 1xx

The 1xx (Informational) class of status code indicates an provisional response for sending connection status or request progress to the browser prior to completing the requested action and sending a final response. Often called a pre-flight request, it uses the OPTIONS method, which you may have heard of if you already know about GET, POST, PUT and DELTE methods. 

  • Success 2xx

The 2xx (Successful) class of status code indicates that the client's request was successfully received, understood, and accepted.

  • Redirection 3xx

 The 3xx (Redirection) class of status code tell us that further action needs to be taken by the user agent in order to fulfill the request.  If a Location header field is given, the user agent may automatically redirect its request to the URI referenced by the Location field value, even if the specific status code is not understood.  
 On the other hand, automatic redirection needs to done with care for methods not known to be safe, as defined in since the user might not wish to redirect a request that is considered unsafe.

  • Client Side Error 4xx

 The 4xx (Client Error) class of status code indicates that the client has not provided enough information required by the server, or the client has provided the information in a way the server does not understand.  

 Except when responding to a HEAD request, the server SHOULD send a representation containing an explanation of the error situation, and whether it is a temporary or permanent condition.  These status codes are applicable to any request method. User agents should display any included representation to the user.

  • Server Side Error 5xx

The 5xx (Server Error) class of status code indicates that the server is aware that is causing the problem or is incapable of performing the requested method.  Except when responding to a HEAD request, the server should send a representation containing an explanation of the error situation, and whether it is a temporary or permanent.

Conclusion

This was a brief explanation over HTTP status codes and the opening article of this series. Stay tuned as we dive deeper and explain each status code in the next articles. Do not forget to leave a comment and share this article with your friends if you found it helpful.