-
-
Notifications
You must be signed in to change notification settings - Fork 6
Home
This is the official API documentation for FitPlan.
Staging endpoints are located at fitplan-staging.herokuapp.com. API version is scoped via the URL. For example:
http://fitplan-staging.herokuapp.com/v1/users/
All timestamps are integers in unix timestamps, the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds.
Example request data:
{
"grant_type": "password",
"email": "therock@gmail.com"
}curl -X POST --data "grant_type=password&email=therock@gmail.com" http://fitplan-staging.herokuapp.com/v1/oauth/token
Example response:
{
"access_token": "4a7bb293c9d7f7354d06ff57abbc000073163555580c6aed49a32704735ec395",
"token_type": "bearer"
}Example request data:
{
"grant_type": "assertion",
"assertion_type": "facebook",
"facebook_access_token": "CAAEZAmtqQDw0BAEVKXzmK1XAcXSqMO5iEytc472XrzFxGdWHiiaUXF0rB9TO0czuvkY7F6tBc9x9L14BAlPTo1Rd99d4ur17G5oZCgk4frZBUmbVZCF9ZBOOOQ0zfHTZCwK6YmyBttkD3EAICwrgx1pbWMUOJA52OEFt7523r4cUPnYeZBymoIsgDxInoVZBOUtQDKrt6YFJPLXcBYpDYrx4ifkD2VZAqmPYZD"
}curl -X POST --data "grant_type=assertion&assertion_type=facebook&facebook_access_token=CAAEZAmtqQDw0BAEVKXzmK1XAcXSqMO5iEytc472XrzFxGdWHiiaUXF0rB9TO0czuvkY7F6tBc9x9L14BAlPTo1Rd99d4ur17G5oZCgk4frZBUmbVZCF9ZBOOOQ0zfHTZCwK6YmyBttkD3EAICwrgx1pbWMUOJA52OEFt7523r4cUPnYeZBymoIsgDxInoVZBOUtQDKrt6YFJPLXcBYpDYrx4ifkD2VZAqmPYZD" http://fitplan-staging.herokuapp.com/v1/oauth/token
Where facebook_access_token is Facebook's User Token obtained from: https://developers.facebook.com/tools/accesstoken/
Example response:
{
"access_token": "7e863e5091f3048c514d6e98a7c5aea8be88b8b852f4792982f4e4500f962382",
"token_type": "bearer"
}Example request data:
{
"user": {
"email": "therock@gmail.com",
"password": "foobar",
"password_confirmation": "foobar",
"username": "therock"
}
}curl -X POST --data "user[email]=therock@gmail.com&user[password]=foobar&user[password_confirmation]=foobar&user[username]=therock" http://fitplan-staging.herokuapp.com/v1/users/create
Example response:
{
"user_id": 1,
"email": "therock@gmail.com",
"username": "therock",
"created_at": 1423799802,
"updated_at": 1423799802
}Example 422 response:
{
"message": "Validation Failed",
"errors": [
"Password can't be blank",
"Password is too short (minimum is 6 characters)",
"Password confirmation doesn't match Password",
"Email has already been taken",
"Email can't be blank",
"Username has already been taken",
"Username can't be blank"
]
}Example request data:
{
"access_token": d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a,
"user": {
"username": "UPDATEDtherock",
"email": "therock@gmail.com",
"password": "foobar",
"password_confirmation": "foobar",
},
"profile": {
"height": 10.5,
"location": "Vancouver",
"avatar": "http://placehold.it/400x400",
"tagline": "Coolest rock on the planet"
}
}curl -X POST --data "access_token=d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a&user[email]=therockUPDATED@gmail.com&user[password]=foobar&user[password_confirmation]=foobar&user[username]=therockUPDATED&profile[height]=10.5&profile[location]=Vancouver&profile[avatar]=http://placehold.it/400x400&profile[tagline]='Coolest rock on the planet'" http://fitplan-staging.herokuapp.com/v1/users/update
Example 200 response:
{
"message": "User Updated"
}Example 422 response:
{
"message": "Validation Failed",
"errors": "Password confirmation doesn't match Password"
}Example request data:
{
"access_token": d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a
}curl -X GET --data "access_token=d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a" http://fitplan-staging.herokuapp.com/v1/users/user_feed
Example response data:
{
"statuses": [
{
"status_id": 1
"status_type": 0,
"text": "Culpa accusamus exercitationem fugit qui sit. Comm...",
"picture": nil,
"video": nil,
"weight": "nil",
"timestamp": "nil",
"created_at": 1424720578,
"updated_at": 1424720578,
"user_id": 1
},
...]
}Example request data:
{
"access_token": d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a
}curl -X GET --data "access_token=d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a" http://fitplan-staging.herokuapp.com/v1/users/profile
Example response data:
{
"user":
{
"user_id": "1",
"email": "therock@gmail.com",
"username": "therock",
"created_at": 1424204900,
"updated_at": 1424204900
}
}{
"title": "Warm Up",
"image": "http://robohash.org/exercise-image.png?size=100x100",
"video": "http://https://s3-us-west-1.amazonaws.com/www.fitplan.io/ios/jeff_workout_plan_1_day_1_exercise_1_400x400",
"icon": "http://robohash.org/exercise-icon.png?size=50x50",
"description": "Eos fugit numquam omnis nihil rem reprehenderit. Est tenetur qui iusto ut dolores molestiae. Voluptatem rerum nisi.",
"activity_type": "Warm Up",
"group": null,
"core_exercise": true,
"sets": 0,
"reps": 0,
"rest_in_min": 0,
"phase": null,
"created_at": 1424204900,
"updated_at": 1424204900,
"workout_day_id": 1
}Example: http://fitplan-staging.herokuapp.com/v1/recipes/1
{
"title": "Easy Baked Chicken",
"video": "http://https://s3-us-west-1.amazonaws.com/www.fitplan.io/ios/callie_week_1_day_1_exercise_8_400x400",
"image": "recipes/easybakedchicken",
"core_recipe": true,
"category": "Proteins",
"created_at": 1424467010,
"updated_at": 1424467010,
"meal_id": null,
"ingredient":
[{
"title": "Broccoli",
"icon": "http://robohash.org/exercise-icon.png?size=50x50",
"quantity_in_g": 1,
"created_at": 1424467011,
"updated_at": 1424467011
}]
}Example: http://fitplan-staging.herokuapp.com/v1/ingredients/1
{
"title": "Broccoli",
"image": "http://placehold.it/640x240",
"icon": "http://robohash.org/exercise-icon.png?size=50x50",
"quantity_in_g": 1,
"description": "Impedit asperiores illum. Delectus aut possimus facere rem fugiat ab commodi. At odit quod et cumque eum omnis exercitationem. Et perspiciatis placeat natus facere recusandae qui eveniet.",
"cal": 43.5,
"prot": 34.5,
"carb": 34.5,
"fat": 3.5,
"category": "veggie",
"created_at": 1424720578,
"updated_at": 1424720578
}Example request data:
{
"status": {
"text": "legs4dayz"
}
}curl -X POST --data "status[text]=legs4dayz" http://fitplan-staging.herokuapp.com/v1/statuses/update
Example request data:
{
"status": {
"text": "legs4dayz",
"picture": "http://www.totelifestyle.com/wp-content/uploads/2014/06/best_leg_makeup_tips.jpg"
}
}curl -X POST --data "status[text]=legs4dayz&status[picture]=http://www.totelifestyle.com/wp-content/uploads/2014/06/best_leg_makeup_tips.jpg" http://fitplan-staging.herokuapp.com/v1/statuses/update
Example request data:
{
"status": {
"weight": 80
}
}curl -X POST --data "status[weight]=80" http://fitplan-staging.herokuapp.com/v1/statuses/update
curl -X POST http://fitplan-staging.herokuapp.com/v1/statuses/1/share
curl -X POST http://fitplan-staging.herokuapp.com/v1/statuses/1/like
Example request data:
{
"access_token": d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a
}curl -X GET --data "access_token=d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a" http://fitplan-staging.herokuapp.com/v1/programs
Example response data:
{
"workout_plans": [
{
"workout_plan_id": 1,
"title": "Jeff's 365 Circuit Trainer",
"image": "http://robohash.org/exercise-image.png?size=100x100",
"video": "http://https://s3-us-west-1.amazonaws.com/www.fitplan.io/ios/jeff_workout_plan_1_day_1_exercise_1_400x400",
"description": "Eos fugit numquam omnis nihil rem reprehenderit. Est tenetur qui iusto ut dolores molestiae. Voluptatem rerum nisi.",
"goal": "bulk",
"duration_in_min": 45,
"days_per_week": 5,
"num_of_weeks": 4,
"created_at": 1424204900,
"updated_at": 1424204900,
"user":
{
"user_id": 1,
"profile":
{
"profile_id": 1,
"avatar": "http://robohash.org/exercise-image.png?size=100x100",
"description": "Eos fugit numquam omnis nihil rem reprehenderit. Est tenetur qui iusto ut dolores molestiae. Voluptatem rerum nisi.",
"first_name": "Jeff",
"last_name": "Seid"
}
}
},...
]
}Example request data:
{
"access_token": d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a
}curl -X GET --data "access_token=d8ac7040d84e2b856c60744fb807bf607df7c62c93833ac305f78d52c4a9f87a" http://fitplan-staging.herokuapp.com/v1/programs/1
Example response data:
{
"title": "Jeff's 365 Circuit Trainer",
"image": "http://robohash.org/exercise-image.png?size=100x100",
"video": "http://https://s3-us-west-1.amazonaws.com/www.fitplan.io/ios/jeff_workout_plan_1_day_1_exercise_1_400x400",
"description": "Eos fugit numquam omnis nihil rem reprehenderit. Est tenetur qui iusto ut dolores molestiae. Voluptatem rerum nisi.",
"goal": "bulk",
"duration_in_min": 45,
"days_per_week": 5,
"num_of_weeks": 4,
"created_at": 1424204900,
"updated_at": 1424204900,
"user":
{
"user_id": 1,
"profile":
{
"profile_id": 1,
"avatar": "http://robohash.org/exercise-image.png?size=100x100",
"description": "Eos fugit numquam omnis nihil rem reprehenderit. Est tenetur qui iusto ut dolores molestiae. Voluptatem rerum nisi.",
"first_name": "Jeff",
"last_name": "Seid"
}
}
}