This tutorial shows you how to use the To-Do Service API to retrieve a list of users using the GET /users
operation.
Before you begin, make sure you have the following:
http://localhost:3000
Retrieving users from the service requires that you use the GET
method on the user
resource.
To retrieve a list of users:
Make sure your local service is running, or start it by using this command, if it’s not.
cd <your-github-workspace>/to-do-service/api
json-server -w to-do-db-source.json
/users
Watch for the response body, which should look something like this. Your list of users may vary depending on what’s stored in your database.
[
{
"id": 1,
"name": "Jane Doe",
"email": "jane@example.com"
},
{
"id": 2,
"name": "John Smith",
"email": "john@example.com"
}
]
After doing this tutorial in Postman, you might like to repeat it in your favorite programming language. To do this, adapt the values from the tutorial to the syntax and arguments that the language uses to make REST API calls.
Now that you’ve retrieved users, you might want to: