We will focus on creating REST services for a basic todo management system. We will create services for the following:
- Retrieving a list of todos for a given user
- Retrieving details for a specific todo
- Creating a todo for a user
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 |
| Read--Retrieve details for a resource |
| Create--Create a new item or resource |
| Update/replace |
| Update/modify a part of the resource |
| 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 useGET
. We will use a URI:/users/{name}/todos
. One more...