How to add desserts to your meal plan

The document will guide you through the steps to add a dessert meal to your generated meal plan.

Overview

The Suggestic API usually generates a 7-day meal plan based on the following format:

BREAKFAST, SNACK, LUNCH, DINNER

Even though there is no DESSERT mealtime category, you can replace a mealtime to include a dessert recipe. Usually, the SNACK mealtime can be replaced with a dessert recipe in an already generated meal plan.

In this example, you will learn how to add a dessert recipe to your meal plan.

Requirements

Considerations

API endpoints to use

Through the example, use the following endpoints in the same order as they are listed below:

Examples

Code Example

Find all the steps detailed below in this graphqlbinarrow-up-right. Modify the code accordingly.

Step by Step Example

Follow the 6 steps below to include a dessert in your meal plan.

circle-info

The first two steps are optional. Follow then only if you don't have a SNACKdefined in your meal plan.

chevron-rightSTEP 1: Add a SNACK meal to your meal plan.hashtag

Remember that the SNACK recipe will be replaced by the DESSERT recipe. If your meal plan does not include the SNACK meal time, execute the following mutation by adding a SNACK meal after LUNCH.

Note: Add a or move the SNACK meal time to any place. For example, if you need to have a SNACK (as a dessert) after the DINNER meal, you can setup the following format:

chevron-rightSTEP 2: Regenerate your meal planhashtag

If you updated the meal plan settings, re-generate your meal plan arrow-up-right

chevron-rightSTEP 3: Identify the mealtime to replacehashtag

Execute the mealPlanarrow-up-right query to identify the mealtime or mealtimes to replace.

Request:

Response:

Copy the meal or meals id of the meal times and save them to use at the moment of swapping the recipes. In the case of the examples, the SNACK mealtime for day 7 is copied:

DAY 7: "id": "TWVhbDo0OTg4Mzg4"

chevron-rightSTEP 4: Get the DESSERT recipe Idhashtag

As was mentioned above, there are different queries to get the dessert information. In the case of this example, the recipesByMealTime query is used.

Request:

Response:

chevron-rightSTEP 5: Swap the SNACK and DESSERT recipes in the meal planhashtag

Execute theswapMealPlanRecipearrow-up-right and replace the mealId copied on step 2 and the recipeID copied on step 4:

chevron-rightSTEP 6: Verify that both recipes were swappedhashtag

Execute the mealPlan query to verify that the recipe has been replaced:

Last updated

Was this helpful?