On this page:
List all or some users: a tutorial
This tutorial should take you about 15 minutes to complete.
Before you begin
- Make sure you’ve set up your environment.
- Start the Orca Sightings service with
json-server.
How to list all users
To use cURL:
- Open a new terminal window.
- Run the following command:
curl -X GET http://localhost:3000/users/
To use Postman:
- In Postman’s main panel on the right, toward the top, select GET.
- Add the following content to the URL text box next to GET:
http://localhost:3000/users/. - Click Send.
View the response
The response body should show all users and look like this:
[
{
"last_name": "Marsh",
"first_name": "Stan",
"email": "stan.marsh@gmail.com",
"id": 1
},
{
"last_name": "Broflovski",
"first_name": "Kyle",
"email": "kyle.broflovski@yahoo.com",
"id": 2
},
{
"last_name": "Cartman",
"first_name": "Eric",
"email": "eric.cartman@hotmail.com",
"id": 3
},
{
"last_name": "McCormick",
"first_name": "Kenny",
"email": "kenny.mccormick@gmail.com",
"id": 4
}
]
In Postman, you should also see a green 200 OK message at the top of the pane. Hover over that text to see the full confirmation message.
That’s it. Next, view the reference topic GET /users to see an example of listing a specific user by its id.
Also, you can try other tutorials like adding a user or view other topics in the API reference.