Creating a Meal Plan
Step by step guide for creating a meal plan
Last updated
Was this helpful?
Step by step guide for creating a meal plan
Last updated
Was this helpful?
Suggestic meal plan API finds the best recipes for your user's dietary plan according to their food preferences and goals. The API has different services and parameters that let you specify how these meal plans are generated.
Let's start by generating a simple meal plan using the generateSimpleMealPlan
mutation.
Remember to replace <User-JWT>
with your user's access token
Once the meal plan is created, you can request the meal plan using the mealPlan
query.
The generateSimpleMealPlan
mutation doesn't require any arguments. It generates a 7-days meal plan that complies with the user's program and preferences.
As you can see in the last response, generateSimpleMealPlan
has series of default values, for example, each day has breakfast, lunch, dinner, and a single snack, with a daily caloric goal of 2000 kcal.
If you need more control over these settings, please review the mutation.
Suggestic meal plan API always generates a 7-day plan.
Each day of the plan has a date. Day 1 has the date when the meal plan was generated, day 2 has the next date, and so on.
By default, generateSimpleMealPlan
and generateMealPlan
put a lock that stops the user from generating a new meal plan if one is in progress. In other words, a user can't generate a new meal plan if the current one still has dates in the future.
If you try using generateSimpleMealPlan
, while a meal plan is in progress, you'll get the following response:
To bypass the lock, send the argument ignoreLock: true
.
You can think of meal plan generation as a two stages process.
In the first stage, the planner finds a set of recipes that are good candidates for a personalized meal plan. These recipes are a good choice according to the user's restrictions, dietary program, and custom attributes. This is the customization stage.
You can learn more about how to set users personal restrictions, subscribing users to programs, and setting their custom attributes as follows:
Restrictions can be added in the following scenarios:
Before generating a meal plan: Define which restrictions you need to apply, and then the meal plan is generated based on the applied restrictions.
During a meal plan in progress: It may be the case where new restrictions need to be applied to the meal plan in progress. In this case, apply these new restrictions and generate the meal plan again.
If the meal plan is finished by the time the restrictions are set, a new 7 day meal plan will be generated where these new restrictions will be applied.
To add a program, update the User Program and then generate the meal plan.
The second stage is configuration. Configurations are sent to the meal planner in each query as parameters and are used to sort and group the recipes into daily plans. This includes grouping constraints, like setting the daily caloric goals, the number of snacks per day, or the minimum serving weight in grams per meal.
You can change configurations and customize as much as you need depending on your app and use cases.
When users have too many restrictions and the meal plan is not capable of generating a whole week of the meal plan, the following error is displayed:
This error may appear due to:
The type of subscription.
The user program.
Refer to the page.
Refer to the page.
Refer to the page.
Learn more about these configurations in the generateMealPlan
.
There is a problem with the definition of macro values. Check your
For more information, refer to .
Read about user , , and to customize a meal plan.
Meal plans are not automatically generated when a user's program, restrictions, or attributes change. Read more about keeping a meal plan updated on the generateMealPlan
.
The mealPlan
response can include fields that are not used here to keep the examples simple. See a full list of fields on the page.
Take a look at the query. It lets you request meal plans without assigning them to the user. You can request as many as you need and can help you find the configuration that works best for your app and use cases.