Chapter 4
- REST is an architectural style for creating web services, and it defines a set of constraints.
- The easiest way to create a RESTful web service with Spring Boot is to use the Spring Data REST starter package. By default, the Spring Data REST package finds all public repositories and creates automatically RESTful web services for your entities.
- You can send a
GET
request to the endpoint of the entity. For example, if you have an entity class calledCar
, the Spring Data REST package creates an endpoint called/cars
that can be used to fetch all cars. - You can send a
DELETE
request to the endpoint of the individual entity item. For example,/cars/1
deletes a car with the ID1
. - You can send a
POST
request to the endpoint of the entity. The header must contain theContent-Type
field with the value application/json. The new item will be embedded in the request body. - You can send a
PATCH
request to the endpoint of the entity. The header must contain theContent...