Exercise is a resource that represents data related to an exercise in the application.
GET api/v1/exercises/
Returns a list of all exercises in the database
None
GET https://simple-training-log.herokuapp.com/api/v1/exercises
200
OK
[
{
"id": 1,
"exercise_name": "Back squat"
},
{
"id": 5,
"exercise_name": "Bench press"
},
{
"id": 9,
"exercise_name": "Bent row"
},
{
"id": 8,
"exercise_name": "Chin up"
},
{
"id": 3,
"exercise_name": "Deadlift"
},
{
"id": 2,
"exercise_name": "Front squat"
},
{
"id": 10,
"exercise_name": "Goblet squat"
},
{
"id": 15,
"exercise_name": "Pull down"
}
]
GET api/v1/exercises/:exercise_id
Returns a single exercise specified by the id
Field | Data Type | Required | Description |
---|---|---|---|
exercise_id | number | Y | The id of the exercise |
GET https://simple-training-log.herokuapp.com/api/v1/exercises/10
200
OK
{
"id": 10,
"exercise_name": "Goblet squat"
}
DELETE api/v1/exercises/:exercise_id
Removes a single exercise specified by the id
Field | Data Type | Required | Description |
---|---|---|---|
exercise_id | number | Y | The id of the exercise |
DELETE https://simple-training-log.herokuapp.com/api/v1/exercises/2
200
OK
{
"message": "delete successful"
}
POST api/v1/exercises
Create a new exercise and return the newly created exercise
Field | Data Type | Required | Description |
---|---|---|---|
exercise_name | string | Y | The name of the exercise |
POST https://simple-training-log.herokuapp.com/api/v1/exercises
{
"exercise_name": "Overhead squat"
}
201
Created
{
"id": 20,
"exercise_name": "Overhead squat"
}
PUT api/v1/exercises/:exercise_id
Update the exercise data with provided body of data
Field | Data Type | Required | Description |
---|---|---|---|
exercise_id | number | Y | The id of the exercise |
Field | Data Type | Required | Description |
---|---|---|---|
exercise_name | string | Y | The name of the exercise |
PUT https://simple-training-log.herokuapp.com/api/v1/exercises/20
{
"exercise_name": "OH squat"
}
200
OK
{
"message": "update successful"
}