Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Status Code | Backend Development Basics
Spring Boot Backend
course content

Зміст курсу

Spring Boot Backend

Spring Boot Backend

1. Backend Development Basics
2. Spring Boot Basics
3. RESTful API
4. Working with Databases
5. Testing Backend Applications

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.

Note

Status codes are three-digit numbers that are categorized into several groups based on their value and purpose.

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.

Note

These codes are typically not visible to the user directly, as they are used for conveying intermediate information between the client and the server.

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.

1. Which status code indicates successful completion of a request and retrieval of data?
2. Which status code is used to inform the client that authentication is required to access the resource?

Which status code indicates successful completion of a request and retrieval of data?

Виберіть правильну відповідь

Which status code is used to inform the client that authentication is required to access the resource?

Виберіть кілька правильних відповідей

Все було зрозуміло?

Секція 1. Розділ 4
We're sorry to hear that something went wrong. What happened?
some-alt