Workout
This endpoint focuses on retrieving user workout sessions. It supports filtering by workout type, dates, and includes pagination capabilities to manage large data sets effectively.
Properties
- Name
user_id
- Type
- string
- Description
UUID of the user. This must be a valid UUID that represents the user whose workout data is being requested.
Get Workout Data
This endpoint allows you to retrieve workout data for a specified user. By default, it returns workout sessions sorted in descending order.
Optional attributes
- Name
startDate
- Type
- string
- Description
The start date to filter the workout data. Must be in ISO 8601 format. Defaults to the earliest workout record if not provided.
- Name
endDate
- Type
- string
- Description
The end date to filter the workout data. Must be in ISO 8601 format. Defaults to the most recent workout record if not provided.
- Name
type
- Type
- string
- Description
The type of workout to filter by. Must be a valid workout metric. If not provided, all workout types are returned.
- Name
sort
- Type
- string
- Description
Specifies the sort order of the workout data, either
asc
for ascending ordesc
for descending. Defaults to descending if not provided.
- Name
page
- Type
- integer
- Description
The page number of results to return. Must be an integer greater than 0. Defaults to 1.
- Name
pageSize
- Type
- integer
- Description
The number of results per page. Must be an integer between 1 and 10,000. Defaults to 1,000.
Request
curl -G https://api.onetwentyone.ai/api/v1/workout/user/123e4567-e89b-12d3-a456-426614174000 \
-H "Authorization: Bearer {token}" \
-d startDate="2022-01-01" \
-d endDate="2022-01-31" \
-d type="traditionalStrengthTraining" \
-d sort="asc" \
-d page=1 \
-d pageSize=50
Response
{
"pagination": {
"current_page": 1,
"has_more": true,
"next_page": "/api/workout/user/123e4567-e89b-12d3-a456-426614174000?startDate=2022-01-01&endDate=2022-01-31&type=traditionalStrengthTraining&page=2&pageSize=50",
"prev_page": null
},
"data": [
{
"id": "WORKOUTSESSION-UUID",
"type": "traditionalStrengthTraining",
"start": "2022-01-01T08:00:00Z",
"end": "2022-01-01T08:30:00Z",
"duration": 1800,
"metadata": "DESCRIPTION HERE"
},
{
"id": "WORKOUTSESSION-UUID",
"type": "traditionalStrengthTraining",
"start": "2022-01-03T07:00:00Z",
"end": "2022-01-03T07:45:00Z",
"duration": 2700,
"metadata": "DESCRIPTION HERE"
}
// More items...
]
}