liveBook · Manning

HTTP method

As explained in Spring Start Here, Second Edition

An HTTP method is the standardized operation token in an HTTP request that indicates the intended action on a resource.

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

How Spring Start Here, Second Edition covers it

How deep it goes
Defines five common methods and works through GET and POST; it does not implement PUT, PATCH, or DELETE.
Examples
Uses a product list and HTML form to contrast GET retrieval with POST addition at /products.
What you can do after
Apply it via Spring MVC mappings to route GET and POST requests at one path to different actions.
How it connects
Connects HTTP methods with request paths, controller actions, and HTML forms.

Also explained in

Compare how 14 books explain HTTP method →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.