0%
Building REST APIs with Spring Boot

REST API

The complete CRUD, and the boundary between the stored model and the exposed model.

15-20 min

Building REST APIs with Spring Boot

A Spring Boot controller takes a few minutes to write. That's why so many APIs share the same flaw: they were written quickly, they work, and the day you need to add an internal field to a table, you discover that a mobile app published last year is going to receive it.

The tipping point for an API is almost never technical. It's contractual. As soon as a client consumes your responses, the shape of those responses becomes a commitment you can no longer change unilaterally. The question that decides everything else is therefore simple: who decides the shape of the JSON? If the answer is "the table," then every schema decision becomes an API decision, made by someone who wasn't thinking about the API.

This lesson builds the complete CRUD for the biblio-api catalog, and along the way establishes the one boundary that matters: the exposed model is a separate object, written specifically for the outside world, independent of the stored model. Everything else — status codes, pagination, versioning — follows from this decision.

We're working here with an in-memory repository; real persistence comes in the next lesson. This lets us deal with API design without being distracted by JPA.

Comments

Comments are powered by GitHub Discussions

Sign in with GitHub to join the discussion

Link copied!