Tutorial: Remove an exercise log
In this tutorial, you’ll learn how to remove an exercise log using the DELETE method to remove entries
that are no longer needed. By eliminating logs of ineffective exercises, you can maintain a clear picture
of what’s actually helping a user’s recovery.
Expect this tutorial to take about 10 minutes to complete.
Before you start
Make sure you’ve completed the Getting Started guide on the development system you’ll use for the tutorial.
Remove an exercise log
Deleting an exercise log requires using the DELETE method to remove a user exercise log
resource from the service. This is useful when you want to remove entries that weren’t effective.
This example removes the Glute Bridges exercise log, ID 2, which wasn’t effective for Sarah Johnson.
-
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
DELETEusing the corresponding dropdown menu. -
In the request URL field, enter:
{base_url}/userExerciseLogs/2
-
Click Send to make the request.
-
The system returns an empty object, confirming the deletion was successful.
{}
cURL request
-
Open your terminal and run this command:
curl -X DELETE {base_url}/userExerciseLogs/2 -
The system returns an empty object, confirming the deletion was successful.
{}
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}/userExerciseLogs?userId=1 -
Click Send.
- You should see that the Glute Bridges exercise log, ID 2, no longer appears in the list. You should only see the remaining exercise logs returned for Sarah Johnson.
Using cURL
-
Run this command:
curl -X GET "{base_url}/userExerciseLogs?userId=1" -
You should see that the Glute Bridges exercise log, ID 2, no longer appears in the list. You should only see the remaining exercise logs returned for Sarah Johnson.
Common errors and troubleshooting
404 not found error
If you receive this error, the exercise log ID you’re trying to delete doesn’t exist. Check for the
correct log ID by calling GET on /userExerciseLogs first to see all available logs.
Wrong log deleted
Double-check the ID in your DELETE request URL. If you accidentally delete the wrong log, you’ll need
to recreate it using the POST method, as deletions can’t be undone.
Log still appears after deletion
If the log still appears when you retrieve the list, your GET request may be returning cached data.
Try adding a timestamp query parameter like ?_t=123456 to force a fresh request.
What you learned
After completing this tutorial, you now know how to remove an exercise log using the DELETE method
with Postman or cURL. This is useful for removing exercises that didn’t help or for cleaning up incorrect
entries. You’re maintaining a focused, accurate record of a user’s healing journey.
Next steps
- Log your first activity to start tracking exercises.
- Compare exercises to see which activities are effective.
- Update a user’s pain level when pain changes.
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.