How to log your custom recipe
The document will guide you through the steps to create and log your custom meal
Overview
Custom recipes is a great way to quickly enter meals into your diary, they let you save food with multiple ingredients so you can quickly add it to your daily log. So, instead of adding individual food you eat at breakfast daily, you can create a "My Breakfast routine" recipe with all of these ingredients. So you time consuming will be way far better.
In this example, you will see how to create and log your custom recipe.
Requirements
To have your own common or branded food created (not mandatory)
API endpoints to use
Through the example, use the following endpoints in the same order as they are listed below:
commonFoodsand/orbrandedFoodsto get the food Id, either for existing common or branded food.createMyCommonFoodsand/orcreateMyBrandedFoodsif you need to add a specific food to create your recipe.myCommonFoodsorMyBrandedFoodsto get theFoodIdalready added. Use this in thecreateMyRecipemutation.createMyRecipeby using theFoodIdgathered before.myRecipesto list the recent recipe created and get its id to log it. (Optional Step)createMealLogmutation to log your meal based on the recipe you created above.
Code Example
Find all the steps detailed below in this graphqlbin. Modify the code accordingly.
Example
Name of the recipe: Vegan Milkshake
Follow the 5 steps below to create the Vegan Milkshake recipe to be then logged into your dairy:
STEP 1: Find the foods to add to your recipe
In the case of this example, use the commonFoods to find the "Vanilla extract".
Request:
Response
FoodID to copy --> Q29tbW9uRm9vZE5vZGU6YzYwZDljOWYtM2IyMy00ZTQxLWE3NDYtNDE2NmE4NzZhMjkz
STEP 2: Create a specific food
In case you need to create a specific food, execute the createMyCommonFoods or createMyBrandedFoods. In the example below, we will create the "Vegan vanilla ice cream" common food:
STEP 3: Find your created foods
Find the foods to include in your recipe. Execute the myCommonFoods or myBrandedFoods queries to find them. In the case of this example, use the myCommonFoods to find your already created ingredient which is the "Vegan vanilla ice cream".
Request:
Response:
From the response, copy the FoodId -> TXlDb21tb25Gb29kOjNpR2RjSUFCYjREdGhOVmFDQWpI
Each ID is different so make sure to copy the Id retrieved in your query response.
Use this query as many times as necessary until you find all the foods the recipe is required to have. See step 2 in case you need to create your food.
STEP 4: Create your own recipe
Use the Food IDs created previously to create your own recipe:
Request:
Response:
Copy the "ID" retrieved from the recipe created to log the meal.
Optional: If you cannot get the "ID", you can execute the myRecipes query to get it.
Last updated
Was this helpful?