Backend documentation
URL to the api: api.cs350.melvinauvray.com/api/v1
(version
can change)
Ingredients
GET
/ingredients
Description: Retrieve the list of all existing ingredients on the app.
Body parameters:
Answer:
POST
/ingredients
Description: Create a new ingredient if it doesn't exist. The id of an ingredient category can be given,
if it is, the newly created ingredient is attached to this category. If the ingredient was already
created, the existing ingredient is atached to the category.
Body parameters:
-
- name: string, required. Name of the ingredient.
-
- ingredientCategoryId: integer, optional. Id of an existing ingredient category.
Answer:
-
The new ingredient just created.
DELETE
/ingredients/{ingredient_id}
Description: remove an ingredient from a category.
Body parameters:
-
- ingredientCategory: integer, required. Id of the ingredient category you want
to remove the ingredient from.
Answer:
-
Error message if the category is not found or is not attached to the
ingredient.
-
Success message if the ingredient has been removed from the category.
Ingredient Categories
GET
/ingredientcategories
Description: Retrieve the list of ingredient categories of a specific user. The list of ingredients is
also attached inside each category.
Body parameters:
-
- userId: integer, required. Id of the user you want to retrieve the ingredient
categories from.
Answer:
-
Error message if the user does not exist.
-
data: array of categories
-
id: id of the category.
- name: name of the category.
- ingredients: array of ingredients attached to this category.
- id: id of the ingredient
- name: name of the ingredient
POST
/ingredientcategories
Description: Create a new ingredient category.
Body parameters:
-
- name: string, required. Name of the category.
- - userId: integer, required. Id of the user that is creating the category.
Answer:
-
Error message if some required fields from body are missing.
-
data: newly created category.
-
id: id of the category.
- name: name of the category.
- ingredients: array of ingredients attached to this category.
- Empty because the category was just created.
DELETE
/ingredientcategories/{category_id}
Description: Delete an ingredient category.
Body parameters:
Answer:
-
Error message if category is not found or if something went wrong during deleting phase.
-
Success message if category has been deleted.
Utensils / Utensils categories
Works the same as the ingredients' endpoints.