SPRING CONCEPTS

HTTP status codes

Spring Concepts / HTTP status codes

HTTP status codes describe the outcome of a request.

Understand the idea

200 means success with a normal response; 201 means a resource was created; 204 means success with no body. 400 indicates an invalid request; 401 indicates missing/invalid authentication; 403 indicates refused access; 404 indicates an unavailable resource; 409 indicates a conflict.

A concrete example

Create → 201 + Location
Delete → 204, no body
Invalid title → 400
Invalid token → 401

In the application

The personal app deliberately returns 404 for another user’s task id, limiting disclosure of foreign resources.

Do not parse a 204 response as JSON. Check the status rather than assuming any body means success.

Related concepts

Read the official documentation ↗
Java 21 · Spring Boot 4.1.1 · Edupoly