A complete guide list of Status Code in HTTP
In this article, we will learn about the most important HTTP Status Codes. Whenever you do anything which gives you the results depending upon your action, the browser requests the site server that responds back to the browser’s request with some status code, which we called HTTP status code.
The result of communication between the browser and server will define whether things are okay, or something is wrong. Most of us are completely unaware of a lot going on in the background. So for developers, it will be easy to debug or diagnose the errors which will help to quickly minimize downtime on your site.
It was a quick introduction to HTTP status codes. Now, Let’s understand it better with more details.
Table of Contents
- What are HTTP Status Codes?
- Common HTTP status code series
- List of HTTP status codes
- 200 OK
- 201 Created
- 204 No-Content
- 301 Moved Permanently
- 304 Not Modified
- 307 Temporary Redirect
- 400 Bad Request
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
- 409 Conflict
- 500 Internal Server Error
- 503 Service Unavailable
- 504 Service Unavailable
- 505 HTTP Version Not Supported
What are HTTP Status Codes?
As a user, nothing is more frustrating than waiting for the page to load and if you have a bit of bad luck then you got some error such as 404 Page Not Found. Sometimes, the webpage is loaded with data when we again refresh the page this depends on the server that how it responds back to the browser.
Common HTTP status code series
The HTTP status code always has 3 digit code, which is classified into five groups, which define the error status type.
1xx Informational Response — Request received and understood. Request processing continues.
2xx Success — The client’s request was successfully received, understood, and accepted.
3xx Redirection — Further action needs to be taken by the user agent in order to fulfill the request.
4xx Client Error — An error may have been caused by the client. The request contains the wrong syntax or cannot be fulfilled.
5xx Server Error — The server failed to fulfill an apparently valid request.
Note: Not all the status codes are errors, some of them are only just to provide the information or responses to action, and don’t require troubleshooting.
I will discuss some of the top HTTP status codes in detail.
List of HTTP status codes
This is the standard response for a successful HTTP request. The information returned with the response depends on the method used in the request. For example:
- For GET requests, you will get the corresponding response in the message body that you have requested.
- For POST requests, the response will include the resource and contain the result of the action.
This status code stated that the request was successful and resulted in a new resource being created.
The status code where the server successfully processed the request, but is not returning any content. For example, if we use a DELETE request, then it returns only status without returning any data. Or if you submit the form, then it also gives you the request-response status.
301 Moved Permanently
The status in which the requested resource has been assigned a new permanent URI and any future references to this resource should use one of the returned URIs.
If the 301 status code is received in response to a request other than GET or HEAD, the user agent must not automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was provided.
304 Not Modified
This status code is received when the user has performed a conditional GET request and access is allowed, but it can’t be modified. Then only the server should respond to the 304 status code.
For example, a browser can request if a resource has been modified since a specific time. If it hasn’t been modified, the status code 304 is sent. Or If so, a status code 200 is sent, along with the resource.
307 Temporary Redirect
The status in which the requested resource has been assigned a Temporary-URI, however, future requests can still use the original URI. Redirection may be altered at some point so, the client should continue to use the Request-URI for future requests.
400 Bad Request
The request that could not understand by the server such as Missing data, invalid parameters, and domain invalidation. A request cannot be fulfilled without the modification of the client’s request.
The request requires authentication, the response must have a WWW-Authentication header field.
If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials or an invalid authentication token.
The status code is similar to 401. The request was a legal request, but the server refuses to accept it. It can be happened due to some requirement of permissions to the client’s request or may need an account to access the resource. Unlike a 401 Unauthorized response, authenticating will make no difference.
404 Not Found
The most common code that most the user will see. The server has not found anything matching the Request-URI (or the resource cannot be found on the server). But may be available again in the future.
It can happen due to an improper requested URI, which is not available on the server.
The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request.
The response should include enough information for the user to recognize the source of the conflict.
500 Internal Server Error
This is also the most common code seen by the users. It happens when the server cannot fulfill a request due to an unexpected issue. A generic error message is given when no more specific message is suitable.
The developers find out the root cause of this error by checking the server logs, the actual problem will be mentioned in the logs.
503 Service Unavailable
The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. This generally happens when something or any deployment is in the process and it will be recovered soon.
504 Service Unavailable
The server was acting as a gateway or proxy and did not receive a timely response from the upstream server specified by the URI.
505 HTTP Version Not Supported
The server does not support, or refuses to support, the HTTP protocol version that was used in the request message. This might be occur when you update browser to a newer version or switch to a modern browser.
So, this was all about the HTTP status codes. These all are the top most status codes that users can face, now you will surely get to know more. It is helpful for developers if they easily understand the error, and resolved the issue.
I hope you enjoyed the article and if you found this useful, then please share it with your friends and colleagues.
If you have any queries please feel free to post them in the comments section or anything that you wanted to ask through mail contact.