The API calls are made in this sequence when creating and editing an account:
Register User
Update Account
Creates the account of the user with the following information.
Request:
{
"age": "integer" /* Between 15 and 60 years */,
"weight": "integer" /* Between 50 and 1000 pounds*/,
"height": "integer" /* Between 48 and 108 inches*/
}
Response:
{
"user_id": "integer"
}
Updates the users information.
Request:
{
"user_id": "integer",
"age": "integer",
"weight": "integer",
"height": "integer"
}
Response:
{
"success": "boolean"
}
The API calls are made in this sequence when the ingredients comes:
Create Custom Ingredient
Update Custom Ingredient
Delete Custom Ingredient
Retrieve Ingredient
Retrieve Ingredients
Creates a new custom ingredient for that user.
Request:
{
"name": "string",
"serving_size_type": "string",
"serving_size": "integer",
"calories": "integer"
}
Updates a single ingredient.
Request:
{
"name": "string",
"serving_size_type": "string",
"serving_size": "integer",
"calories": "integer"
}
Deletes ingredient.
Response:
{
"success": "boolean"
}
Retrieves a single ingredient.
Response:
{
"id": "integer",
"name": "string",
"serving_size_type": "string",
"serving_size": "integer",
"calories": "integer"
}
Retrieves all ingredients.
Response:
[
{
"id": "integer",
"name": "string",
"serving_size_type": "string",
"serving_size": "integer",
"calories": "integer"
},
...
]
Creates an empty recipe.
Request:
{
"author_id": "integer",
"name": "string",
"servings": "integer"
}
Response:
{
"id": "integer"
}
Edits an existing recipe.
Request:
{
"name": "string",
"servings": "integer"
}
Deletes an existing recipe. The recipe will only be deleted if user_id
matches the recipe's author_id
.
Request:
{
"user_id": "integer"
}
Adds one or more ingredients to a recipe.
Request:
[
{
"ingredient_id": "integer",
"quantity": "integer",
},
...
]
Removes one or more ingredients from a recipe.
Request:
[
{
"ingredient_id": "integer"
},
...
]
Retrieves a recipe.
Response:
{
"name": "string",
"created_by": "integer",
"servings": "integer",
"ingredients": [
{
// /ingredient/{ingredient_id} response
},
...
],
"net_calories": "integer",
"net_protein": "integer",
"net_carbs": "integer"
}
Request:
Create a plan for a specific user
{
"user_id": "integer",
"name": "string",
"start_date": "YYYY-MM-DD",
"end_date": "YYYY-MM-DD",
"daily_calorie_goal": "number"
}
Response:
{
"meal_plan_id": "integer"
}
{
"date": "YYYY-MM-DD",
"meal_type": "string", // e.g., breakfast, lunch
"recipe_id": "integer",
"servings": "integer"
}
Response:
{
"message": "Recipe added successfully."
}
Edit the details of an existing meal plan (name, dates, calorie goal).
{
"name": "string",
"start_date": "YYYY-MM-DD",
"end_date": "YYYY-MM-DD",
"daily_calorie_goal": "number"
}
Delete an existing meal plan.
Response:
{
"message": "Meal plan deleted successfully."
}
Retrieve details of a specific meal plan.
Response:
{
"meal_plan_id": "integer",
"name": "string",
"start_date": "YYYY-MM-DD",
"end_date": "YYYY-MM-DD",
"daily_calorie_goal": "number",
"meals": [
{
"date": "YYYY-MM-DD",
"meal_type": "string",
"recipes": [
{
"recipe_id": "integer",
"name": "string",
"calories": "number"
}
]
}
],
"total_calories": "number"
}
Retrieve all meal plans for a specific user.
Response:
[
{
"meal_plan_id": "integer",
"name": "string",
"start_date": "YYYY-MM-DD",
"end_date": "YYYY-MM-DD"
}
]
Return a summary of your meal plan calorie total.
Response:
{
"number_of_calories": "number",
)
Return a summary of the amount of calories burned which is your intake minus your exercise input
Response:
{
"calories_burned": "number"
}