Tutorial: Create your first user profile
In this tutorial, you’ll create a new user profile using the POST method to add a new user to the
SciaticaSisters API.
Expect this tutorial to take about 10 minutes.
Before you start
Make sure you’ve completed the Getting Started guide on the development system you’ll use for the tutorial.
Create a new user profile
Creating a new user profile requires using the POST method to add a new user resource
to the service. The POST method creates a new user with all required information.
This example creates a profile for a new user named Emma Davis.
-
Make sure your local service is running, or start it by using this command in the terminal:
cd <your-github-workspace>/SciaticaSisters-API/api json-server -w sciatica-sisters-db-source.json
Postman request
- Open Postman and create a new request:
- Click New > HTTP or the + icon in the header.
- Set the request method to
POSTusing the corresponding dropdown menu. -
In the request URL field, enter:
{base_url}/users
- Set up the request headers:
- Click the Headers tab below the URL field.
- Add a header:
- Key:
Content-Type - Value:
application/json
- Key:
- Set up the request body:
- Click the Body tab below the URL field.
- Select raw from the radio button options.
- Select JSON from the dropdown menu on the right.
-
In the text area, enter:
{ "firstName": "Emma", "lastName": "Davis", "email": "e.davis@example.com", "age": 45, "painLocation": "glute-right", "painLevel": 6, "diagnosisDate": "2025-01-15" }
-
Click Send to make the request.
-
The system returns the complete new user object with an assigned ID. Note that the system automatically generates the
idfield.{ "id": 5, "firstName": "Emma", "lastName": "Davis", "email": "e.davis@example.com", "age": 45, "painLocation": "glute-right", "painLevel": 6, "diagnosisDate": "2025-01-15" }
cURL request
-
Open your terminal and run this command:
curl -X POST {base_url}/users \ -H "Content-Type: application/json" \ -d '{ "firstName": "Emma", "lastName": "Davis", "email": "e.davis@example.com", "age": 45, "painLocation": "glute-right", "painLevel": 6, "diagnosisDate": "2025-01-15" }' -
The system returns the complete new user object with an assigned ID. Note that the system automatically generates the
idfield.{ "id": 5, "firstName": "Emma", "lastName": "Davis", "email": "e.davis@example.com", "age": 45, "painLocation": "glute-right", "painLevel": 6, "diagnosisDate": "2025-01-15" }
Check your results
Postman verification
- Create a new request in Postman.
- Set the request method to
GET. -
In the request URL field, enter:
{base_url}/users -
Click Send.
- You should see Emma Davis in the list of users with her assigned ID. The new user appears at the end of the user list.
cURL verification
-
Run this command:
curl -X GET {base_url}/users -
You should see Emma Davis in the list of users with her assigned ID. The new user appears at the end of the user list.
Common errors and troubleshooting
Missing required fields
If you receive a 400 Bad Request error, check all required fields are in your request body:
firstName, lastName, email, age, painLocation, painLevel, and diagnosisDate.
Invalid pain location value
The painLocation field only accepts specific values. Use one of: lower-back-left, lower-back-right,
glute-left, glute-right, calf-left, or calf-right.
Malformed JSON syntax
If you receive a JSON parsing error, check your request body for missing commas between fields, missing quotes around strings, or mismatched brackets. JSON validators can help identify these issues.
What you learned
After completing this tutorial, you now know how to create a new user profile using the POST method
with Postman or cURL. This is the first step for any user who wants to track their sciatica pain and
recovery journey.
Next steps
- Update a user’s pain level when pain changes.
- Log your first activity to start tracking exercises.
- Compare exercises to see which activities are effective.
Related topics
Security note
In a production environment, this operation would require proper authentication to ensure only authorized users can change patient data. See Authentication for details.