Every element (or CRUD) follows the same principles:
- Has 5 routes
- The "get one" and "delete" routes are followed by the id of the element to get/delete
This is an example with the "users" element:
Users
Route: user/
Request body:
{
"DNI": String,
"Name": String,
"Surname": String,
"Email": String,
"Phone": String,
"BirthDate": String,
"Address": String,
"UserRole": Int
}
Filtered
This means that the "user" calls are as follows:
- Create (POST): user/
- Get one (GET): user/:id
- Get filtered (GET): user/
- Update (PUT): user/
- Delete (DELETE): user/:id
Also, the create, update and get filtered need a request body as specified.
The filtering of the "Get filtered" call can be done with any of the fields of the request body, for example, we would filter users with the admin role performing a GET request to user/ with this request body:
{
"UserRole": 1
}
The filtering is only available on calls wich have a filtering tick mark like this one: Filtered
Every url defined in the V1 version prepends /v1/
Route: user/
Request body:
{
"DNI": String,
"Name": String,
"Surname": String,
"Email": String,
"Phone": String,
"BirthDate": String,
"Address": String,
"UserRole": Int
}
Filtered
Route: assignedRoutine/
Request body:
{
"UserID": Int,
"Name": String,
"Description": String,
"BaseRoutineID": Int
}
Filtered
Route: routineSpecificExercises/
Request body:
{
"BaseExercisesID": Int,
"AssignedRoutinesID": Int,
"Series": Int,
"Repetitions": Int
}
The create method requires only the "BaseExercisesID" and "AssignedRoutinesID" fields.
Filtered
Route: permission/
Request body:
{
"Description": String
}
Filtered
Route: role/
Request body:
{
"Description": String,
"Permissions": []Permissions
}
Filtered
Route: baseExercise/
Request body:
{
"Name": String,
"Description": String,
"VideoURL": String,
"CategoryID": Int,
"DefaultSeries": Int,
"DefaultRepetitions": Int,
"Muscles": []Muscle
}
Filtered
Route: baseRoutine/
Request body:
{
"CategoryID": Int,
"Name": String,
"Description": String,
"BaseExercises": []BaseExercise
}
Filtered
Route: routineCategory/
Request body:
{
"Name": String
}
Route: exerciseCategory/
Request body:
{
"Name": String
}
Route: muscle/
Request body:
{
"Name": String
}
These calls do not have the basic CRUD functionality, instead these are for geting specific data or performing various specific tasks.
Route: resetPassword/:userId
route method: GET
Request body: none
This element only has two calls, one for getting the user stats and other for updating them (GET & PUT).
Route: userStat/:userId
Request body: none
POST This call adds a new weight history point to the specified user.
Route: userWeight/:userId
Request body:
{
"Weight": Float,
"Date": String,
"UserID": Int
}
GET This call gets a paged lsit of the user's weight history.
Route: userWeight/:userId
Request body:
{
"Size": Int,
"Offset": Int
}
Return body:
[
{
"ID": Int,
"Weight": Float,
"Date": String,
"UserID": Int
}
...
]
POST This call creates a history point of the routine specific exercise indicated in the request body
Route history/
Request body:
{
"Measure": float,
"MeasureUnit": String 's' | 'kg' | 'ms',
"MeasureType": String 'weight' | 'exerciseMetric',
"Date": String,
"RoutineSpecificExercisesID": Int
}
GET This call gets a paged list of the history points of a specific exercise
Route history/:specExerciseId
Request body:
{
"Size": Int,
"Offset": Int
}
Return body:
{
"Measure": Int,
"MeasureUnit": String,
"MeasureType": String,
"Date": String,
"RoutineSpecificExercisesID": Int
}