Request methods, operations, and URIs

One of the best practices of REST services is to use the appropriate HTTP request method based on the action we perform. In the services we exposed until now, we used the GET method, as we focused on services that read data.

The following table shows the appropriate HTTP Request method based on the operation that we perform:

HTTP Request Method Operation
GET Read--Retrieve details for a resource
POST Create--Create a new item or resource
PUT Update/replace
PATCH Update/modify a part of the resource
DELETE Delete

Let's quickly map the services that we want to create to the appropriate request methods:

  • Retrieving a list of todos for a given user: This is READ. We will use GET. We will use ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.