This tutorial shows how to use the GET method to retrieve the data for all tasks in the service.
This tutorial takes about 15 minutes to complete.
Ensure that you have completed the Add a new task topic and that you have added tasks to your service.
Use the GET method to fetch all of your tasks in the service.
{
cd <your-github-workspace>/to-do-service/api
json-server -w to-do-db-source.json
}
/tasksContent-Type: application/jsonNOTE: The names should be the same as the ones used in your Request body and the response should include the
user_idfor each task. For example:
{
"user_id": 1,
"title": "Grocery shopping",
"description": "eggs, bacon, gummy bears",
"due_date": "2025-02-20T17:00",
"warning": "-10",
"id": 1
}
For details, refer to the task resource.