Course Content
Spring Boot Backend
Spring Boot Backend
Status Code
We have already seen these statuses when the server returned an HTTP response, and in the response header, we could observe the status code, which conveys specific information about the result.
What are Request and Response Statuses?
When a client sends a request to a server, the server returns a response that includes a status code. This status code informs the client about the outcome of the request processing.
Status Code Groups
Informational Codes (1xx)
This status code indicate the intermediate steps in the processing of a request.
Examples include 100 Continue
, which indicates that more data is expected, and 101 Switching Protocols
, which signals a switch to a different protocol.
Successful Codes (2xx)
This status code confirm that a request has been successfully processed. For example, 200 OK
means that the request was successful and the data has been transferred. 201 Created
indicates that a new resource has been created, while 204 No Content
signals that the request was successful, but there is no data to return in the response.
Typically, this status code indicates that everything is fine, and if everything has loaded correctly on your end, it likely means the server returned a successful status code.
Redirection Codes (3xx)
This status codes require the client to be redirected to a different URL. For example, 301 Moved Permanently
indicates that a resource has been permanently moved, 302 Found
refers to a temporary redirection, and 304 Not Modified
indicates that there have been no changes to the resource.
Redirection Codes (4xx)
This status code indicate errors in the client's request. The 400 Bad Request
code points to a syntactical error, 401 Unauthorized
requires authentication, 403 Forbidden
denies access to the resource, and 404 Not Found
indicates that the resource is not available.
You've likely encountered this type of error at least once and received a warning page indicating that something went wrong on your end.
Server errors (5xx)
This status code indicate problems on the server side. The 500 Internal Server Error
reports an unexpected error, 502 Bad Gateway
points to an invalid response from an upstream server, and 503 Service Unavailable
signals that the server is temporarily unavailable.
This type of error should be avoided in your applications as much as possible, as it indicates a server-side issue, meaning something went wrong on the server.
Summary
These statuses help ensure proper and effective interaction between the client and server, as well as provide reliability and usability for web applications.
Here’s a table displaying the most commonly encountered status codes you may encounter in your applications.
Of course, this is not a complete list of status codes; there are numerous codes, and memorizing them all can be challenging and unnecessary.
Instead, you can easily look up any status code, such as "status code 200", or visit this website, which contains a comprehensive collection of all status codes.
Thanks for your feedback!