Hi folks, Hope you are doing well.I am very happy to see you here again. So let’s dive into the ultimate inventory of the Http response status codes.
Many times during the development we ignore the HTTP response while working with the APIs requests but all these response codes are really important to control the flow, logic, and mechanism.
Introduction
When a developer raises a request ( GET, PUT, POST, PATCH ) to the server there are some of the scenarios that could occur:
- Successful response from the API request.
- Failure response from the API request.
- No response from the API request.
- API produces a server error response.
That’s why we can see there are infinite no possibilities we can face while working with the server (API request). Hence we can say that there are endless possibilities because of that the status codes come across to resolve the issue and cover the maximum no of possibilities with the help of some code. Hence we can say that the HTTP response code is a strong metal bridge of communication between the logic/mechanism and the server.
Now let’s start with the Informational Codes Series.
Informational Codes Series
This series of codes is purely informational in nature and their range lies between 100-199.
Code | Description |
---|---|
100 | This response code says that the client should continue the request or ignore the response if the request is already finished. |
101 | This code is sent in response to an Upgrade request header from the client and indicates the protocol the server is switching to. |
102 | This response code says that the server receives your request and the request is in processing and the response is not available yet. |
103 | This status code is primarily intended to be used with the Link header, letting the user agent start preloading resources while the server prepares a response. |
Successful Response Codes Series
This series of HTTP response codes have the information about the headers when Api passes a successful response and the range for this series lies between 200-299.
Code | Description |
---|---|
200 | Indicates the full success of an operation. Nothing went wrong. |
201 | Created: This code is used mainly for REST APIs when the client requests to create a new entity in the server. |
202 | Accepted: The request has been received but not yet acted upon. It is intended for cases where another process or server handles the request, or for batch processing. *It is noncommittal since there is no way in HTTP to later send an asynchronous response indicating the outcome of the request. |
203 | Non-authoritative information: This response code means the returned metadata is not exactly the same as is available from the origin server, but is collected from a local or a third-party copy. |
204 | No Content: Says no content to send for this request, but the headers may be useful. The user agent may update its cached headers for this resource with the new ones. |
206 | Partial Content: This response code is used when the Range header is sent from the client to request only part of a resource. |
Redirection Messages Codes Series
This series of response codes have the information about the additional actions needed from the client to complete the request and the range for this series lies between 300-399.
Code | Description |
---|---|
300 | Multiple Choices: The request has more than one possible response. The user agent or user should choose one of them. |
301 | Moved permanently: This status code is indicating that the resource that the client was trying to get has been moved permanently to another location. |
302 | Found: It indicates that the user is required to perform a temporary redirect for some reason, but the browsers started implementing this code as 303 See Other. |
308 | Permanent Redirect: This code, as the name indicates, is used to specify a permanent redirect for a resource. It could be confused with 301, but there is a small difference, the 308 code does not allow the HTTP method to change. |
Client Errors Response Codes Series
This series of responses indicated the error generated by the client. The range for this series lies in between 400-499.
Code | Description |
---|---|
400 | Bad Request: It indicates that the request from the user is syntactically incorrect. There could be a lack of validation or a parameter. |
401 | Unauthorized: It indicates a lack of authentication of the client. |
403 | Forbidden: It says that the user does not have enough privileges. |
404 | Not Found: It Says the resource is not found in the server. This is the error that you get when you navigate to a page that does not exist. |
405 | Method Not Allowed: The request method is known by the server but is not supported by the target resource. For example, an API may not allow calling DELETE to remove a resource. |
406 | Not Acceptable: This response is sent when the web server, after performing server-driven content negotiation, doesn’t find any content that conforms to the criteria given by the user agent. |
407 | Proxy Authentication Required: This is similar to 401 Unauthorized but authentication is needed to be done by a proxy. |
408 | Request timeout: It means that the server would like to shut down this unused connection. |
In this series there are a lot more codes if you can take a look click here.
Server Error Response Codes Series
This series of codes indicates the processing error in the server. The range for this series lies between 500-599.
Code | Description |
---|---|
500 | Internal Server Error: It indicates that an error has occurred in the software on the server. |
501 | Not Implemented: This error status code indicates that the server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource. |
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. |
503 | Service Unavailable: This code is issued when the server is not available for some reason, either an excess of the load or the server is down. |
504 | Gateway Timeout: This error response is given when the server is acting as a gateway and cannot get a response in time. |
510 | Not Extended: Further extensions to the request are required for the server to fulfill it. |
511 | Network Authentication Required: Indicates that the client needs to authenticate to gain network access. |
Conclusion
These codes may seem confusing or intimidating on the surface, but HTTP status codes are actually very informative. By learning some of the common ones, you can troubleshoot problems on your site more quickly. You can find the complete list of HTTP response codes here.
Hey, let’s stay in touch!
If you liked this blog, please share it with your friends and colleagues. Connect with FE studio on LinkedIn to read more about such topics.