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 ...