Fitness Trackr is a platform where fitness enthusiasts can share their workouts and discover new routines. Anyone can browse the site and make an account, and users with an account will be able to upload and manage their own activities.
The URL to access a resource from this API is structured as follows:
https://fitnesstrac-kr.herokuapp.com/api
/activities
For example, the URL for all activities would be:
https://fitnesstrac-kr.herokuapp.com/api/activities
When using the API, many calls are made in the context of a registered user. The API protects itself by requiring a token string passed in the header for requests made in that context.
The Authorization
header should be a string with the format Bearer token
;
the token is received either by registering or logging in.
Deviating from this format will cause the API to not recognize the token
and will result in an error.
If the token is malformed, missing, or has been revoked, you will get a response specific to that.
username required | string the username of the user |
password required | string the password of the user |
object | |
message | string the success message |
token | string the JSON Web Token used to authenticate the user for any future requests |
{- "username": "superman27",
- "password": "krypt0n0rbust"
}
{- "user": {
- "id": 1,
- "username": "superman27"
}, - "message": "Success!",
- "token": "abcdefghijklmnopqrstuvwxyz"
}
username required | string the username of the user |
password required | string the password of the user |
object | |
message | string the success message |
token | string the JSON Web Token used to authenticate the user for any future requests |
{- "username": "superman27",
- "password": "krypt0n0rbust"
}
{- "user": {
- "id": 1,
- "username": "superman27"
}, - "message": "Success!",
- "token": "abcdefghijklmnopqrstuvwxyz"
}
name | string the name or title of the activity |
description | string the description of the activity |
id | number the database identifier of the activity |
creatorId | number the database identifier of the user who created this activity |
[- {
- "name": "Incline Dumbbell Hammer Curl",
- "description": "Lie down face up on an incline bench and lift the barbells slowly upward toward chest",
- "id": 1,
- "creatorId": 9
}
]
A valid token must be passed with this request or it will be rejected.
name required | string the name or title of the activity |
description required | string the description of the activity |
name | string the name or title of the activity |
description | string the description of the activity |
id | number the database identifier of the activity |
creatorId | number the database identifier of the user who created this activity |
{- "name": "Incline Dumbbell Hammer Curl",
- "description": "Lie down face up on an incline bench and lift the barbells slowly upward toward chest"
}
{- "name": "Incline Dumbbell Hammer Curl",
- "description": "Lie down face up on an incline bench and lift the barbells slowly upward toward chest",
- "id": 1,
- "creatorId": 9
}
id required | number Example: 123 the ID of the activity to get |
name | string the name or title of the activity |
description | string the description of the activity |
id | number the database identifier of the activity |
creatorId | number the database identifier of the user who created this activity |
creatorName | string the name of the user who created this activity |
{- "name": "Incline Dumbbell Hammer Curl",
- "description": "Lie down face up on an incline bench and lift the barbells slowly upward toward chest",
- "id": 1,
- "creatorId": 9,
- "creatorName": "Albert"
}
id | number the database identifier of the routine |
name | string the name or title of the routine |
goal | string the fitness goal of the routine |
creatorId | number ID of the user who created the routine |
creatorName | string name of the user who created the routine |
Array of objects the sets of activities to perform in this routine |
[- {
- "id": 85,
- "name": "Chest Day",
- "goal": "to beef up the chest and triceps!",
- "creatorId": 1,
- "creatorName": "Albert",
- "sets": [
- {
- "name": "Incline Dumbbell Hammer Curl",
- "description": "Lie down face up on an incline bench and lift the barbells slowly upward toward chest",
- "activityId": 1,
- "routineId": 85,
- "count": 8,
- "id": 29
}
]
}
]
A valid token must be passed with this request or it will be rejected.
name required | string the name or title of the routine |
goal required | string the fitness goal of the routine |
{- "name": "Chest Day",
- "goal": "to beef up the chest and triceps!"
}
{- "id": 85,
- "name": "Chest Day",
- "goal": "to beef up the chest and triceps!",
- "creatorId": 1,
- "creatorName": "Albert"
}
A valid token must be passed with this request or it will be rejected. Furthermore, that token must represent the user who created the routine.
activityId required | number the ID of the activity to perform in this set |
routineId required | number the ID of the routine this set belongs to |
count required | number the number of reps to perform the activity in this set |
{- "activityId": 1,
- "routineId": 85,
- "count": 8
}
{- "activityId": 1,
- "routineId": 85,
- "count": 8,
- "id": 29
}