Tutorial: Enroll a new user
In this tutorial, you learn the operations to call to enroll a new user into the service.
Expect this tutorial to take about 15 minutes to complete.
Before you start
Make sure you’ve completed the Before you start a tutorial topic on the development system you’ll use for the tutorial.
Enroll a new user
Adding a new task to the service requires that you use the POST
method to store the details of the new task
resource in the service.
Enrolling a new user in the service requires that you use the POST
method to store the details of a new user
resource in the service.
To enroll a new user:
-
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
- Open the Postman app on your desktop.
- In the Postman app, create a new request with these values:
- METHOD: POST
- URL:
/users
- Headers:
Content-Type: application/json
-
Request body: You can change the values of each property as you’d like.
{ "last_name": "Jones", "first_name": "Jenny", "email": "jen.jones@example.com" }
- In the Postman app, choose Send to make the request.
-
Watch for the response body, which should look something like this. Note that the names should be the same as you used in your Request body and the response should include the new user’s
id
.{ "last_name": "Jones", "first_name": "Jenny", "email": "jen.jones@example.com", "id": 5 }
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 properties and arguments that the language uses to make REST API calls.