An HTTP method is a verb that expresses the client’s intended action. Together, the method and request path identify an HTTP request. Use GET to retrieve data without changing it; using GET to change data goes against its intended purpose. section 8.2 section 8.4
One path, two actions
A product app can use GET /products to display its product list and POST /products to add a product submitted through an HTML form. In Spring MVC, @GetMapping and @PostMapping associate each action with the same path. section 8.2
Table 8.2 Basic HTTP methods you’ll often encounter in web apps
|
HTTP method
|
Description
|
|
GET
|
The client’s request only retrieves data.
|
|
POST
|
The client’s request sends new data to be added by the
server.
|
|
PUT
|
The client’s request changes a data record on the server
side.
|
|
PATCH
|
The client’s request partially changes a data record on
the server side.
|
|
DELETE
|
The client’s request deletes data on the server side.
|
Compare the intended actions of five common methods: retrieving, adding, changing, partly changing, and deleting data. section 8.2













