Challenges API
GET /api/challenges
List all challenges for the authenticated client.
Query Parameters
clientId: string (required) — The client identifier. If not found, a 500 error is returned.
Headers:
Authorization: Bearer <JWT>
Response
200 OK:{ data: Array<Challenge> }500 Internal Server Error:{ error: 'Client ID not found' | string }
Each Challenge object includes:
Sample Challenge Object
{
"id": "challenge123",
"title": {
"en": "Pushup Challenge",
"zh-Hant": "伏地挺身挑戰",
"zh-Hans": "俯卧撑挑战"
},
"description": {
"en": "Do as many pushups as you can!",
"zh-Hant": "盡量多做伏地挺身!",
"zh-Hans": "尽量多做俯卧撑!"
},
"videoUrl": "https://example.com/challenge.mp4",
"thumbnailUrl": "https://example.com/challenge.png",
"repCounterConfig": {
/* ... */
},
"algo": "pose-checkpoints",
"type": "timeAttack",
"repForMaxScore60Seconds": 50,
"durationForMaxScore30Reps": 60,
"caloriesBurnedPerRep": 0.5,
"order": 1,
"status": "active",
"createdAt": "2024-05-01T10:00:00.000Z",
"updatedAt": "2024-05-10T10:00:00.000Z"
}
note
Requires a valid JWT for the client.
Returns all challenge objects for the client.
The actual schema may include additional fields. For the most up-to-date schema, refer to the challenge model/interface in your codebase.
All fields may not be present on every challenge. Optional and nullable fields are indicated above.
title and description are multilingual objects supporting en, zh-Hant, and zh-Hans keys.