This document outlines the REST API endpoints provided by the How2Lift backend service.
All API endpoints are relative to the base URL:
https://api.how2lift.com/ # Production (not yet hosted)
http://localhost:8080/ # DevelopmentGET /musclesResponse:
[
{
"id": 1,
"name": "Quadriceps"
},
{
"id": 2,
"name": "Hamstrings"
}
]GET /machinesResponse:
[
{
"id": 1,
"name": "Leg Press",
"muscleNames": ["Quadriceps", "Hamstrings"],
"imageUrl": "http://localhost:8080/files/legpress.png"
},
{
"id": 2,
"name": "Lat Pulldown Machine",
"muscleNames": ["Lats", "Biceps", "Shoulders"],
"imageUrl": "http://localhost:8080/files/latpulldown.png"
}
]GET /machines/{id}Parameters:
id- Machine ID
Response:
{
"id": 1,
"name": "Leg Press",
"description": "A machine for training leg muscles",
"imageUrl": "http://localhost:8080/files/legpress.png",
"exerciseIds": [1, 2, 3],
"trainedMuscleIds": [1, 2]
}GET /machines/{id}/exercisesParameters:
id- Machine ID
Response:
[
{
"id": 1,
"name": "Standard Leg Press",
"description": "Basic leg press movement",
"videoUrl": "http://localhost:8080/files/standard-leg-press.mp4",
"steps": ["Sit on the machine", "Place feet on platform", "Push the platform"],
"commonMistakes": ["Locking knees", "Using too much weight"],
"machineId": 1,
"trainedMuscleIds": [1, 2],
"repType": "STANDARD"
}
]GET /machines/{id}/musclesParameters:
id- Machine ID
Response:
[
{
"id": 1,
"name": "Quadriceps"
},
{
"id": 2,
"name": "Hamstrings"
}
]GET /exercisesResponse:
[
{
"id": 1,
"name": "Standard Leg Press",
"muscleNames": ["Quadriceps", "Hamstrings"],
"videoUrl": "http://localhost:8080/files/standard-leg-press.mp4"
},
{
"id": 2,
"name": "Wide Leg Press",
"muscleNames": ["Quadriceps", "Hamstrings", "Glutes"],
"videoUrl": "http://localhost:8080/files/wide-leg-press.mp4"
}
]GET /exercises/{id}Parameters:
id- Exercise ID
Response:
{
"id": 1,
"name": "Standard Leg Press",
"description": "Basic leg press movement",
"videoUrl": "http://localhost:8080/files/standard-leg-press.mp4",
"steps": [
"Sit on the machine",
"Place feet on platform",
"Push the platform"
],
"commonMistakes": [
"Locking knees",
"Using too much weight"
],
"machineId": 1,
"trainedMuscleIds": [1, 2],
"repType": "STANDARD"
}GET /exercises/{id}/musclesParameters:
id- Exercise ID
Response:
[
{
"id": 1,
"name": "Quadriceps"
},
{
"id": 2,
"name": "Hamstrings"
}
]GET /files/{filename}Parameters:
filename- Name of the file to retrieve
Response:
- Binary file data with appropriate content type
GET /files/{filename}/thumbnailParameters:
filename- Name of the video file
Response:
- Binary image data (thumbnail of the video)
POST /ai/machinesRequest:
- Content-Type:
multipart/form-data - Form field:
file(binary image data)
Response:
[
{
"id": 1,
"name": "Leg Press",
"description": "A machine for training leg muscles",
"imageUrl": "http://localhost:8080/files/legpress.png",
"trainedMuscles": [
{
"id": 1,
"name": "Quadriceps"
},
{
"id": 2,
"name": "Hamstrings"
}
]
}
]POST /ai/suggest/musclesResponse:
[
"Latissimus Dorsi",
"Deltoids",
"Trapezius"
]POST /ai/suggest/machinesResponse:
[
{
"id": null,
"name": "Chest Press",
"description": "Machine for chest development",
"imageUrl": null,
"trainedMuscles": [
{
"id": 3,
"name": "Pectoralis"
}
]
}
]POST /ai/suggest/exercisesResponse:
[
{
"id": null,
"name": "Seated Row",
"description": "Back exercise for mid-back development",
"steps": "Sit on the machine with feet on platform...",
"commonMistakes": "Rounding the back, using too much momentum...",
"videoUrl": "https://example.com/seated-row.mp4",
"trainedMuscles": [
{
"id": 4,
"name": "Latissimus Dorsi"
}
]
}
]These endpoints are for admin use and provide HTML forms:
GET /forms/muscles- Manage muscle groupsPOST /forms/muscles- Add new muscle groupsGET /forms/machines- Manage machinesPOST /forms/machines- Add new machinesGET /forms/exercises- Manage exercisesPOST /forms/exercises- Add new exercisesGET /files- Manage file uploadsPOST /files- Upload a new file
All endpoints may return the following error responses:
- 400 Bad Request: Invalid input parameters
- 401 Unauthorized: Authentication required
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Resource not found
- 500 Internal Server Error: Server-side error
Error response format:
{
"status": 400,
"error": "Bad Request",
"message": "Invalid input parameters",
"timestamp": "2023-10-15T10:30:00Z",
"path": "/api/v1/exercises/invalid-id"
}Most endpoints require password authentication for write operations. This is typically provided via a password parameter for form submissions.
{
"id": 1,
"name": "Leg Press",
"description": "A machine for training leg muscles",
"imageUrl": "http://localhost:8080/files/legpress.png",
"exerciseIds": [1, 2, 3],
"trainedMuscleIds": [1, 2]
}{
"id": 1,
"name": "Standard Leg Press",
"description": "Basic leg press movement",
"videoUrl": "http://localhost:8080/files/standard-leg-press.mp4",
"steps": ["Sit on the machine", "Place feet on platform", "Push the platform"],
"commonMistakes": ["Locking knees", "Using too much weight"],
"machineId": 1,
"trainedMuscleIds": [1, 2],
"repType": "STANDARD"
}{
"id": 1,
"name": "Quadriceps"
}{
"id": "550e8400-e29b-41d4-a716-446655440000",
"exerciseId": 1,
"date": "2023-10-15T10:30:00Z",
"weight": 100,
"reps": 12,
"sets": 3,
"note": "Felt strong today"
}