Creating a meal plan
You can prepare a complete meal plan for the whole week against a profile using this endpoint. To do so, you would have to call it with the POST method, for each day of the week separately. A sample request for monday meal plan against a particular profile looks like the following:
{
"profile_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"day": "mon",
"meals": [
{
"meal_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"category": "breakfast"
}
{
"meal_id": "3fa85f64-5717-4562-b3fc-2c963f66afa7",
"category": "lunch"
}
{
"meal_id": "3fa85f64-5717-4562-b3fc-2c963f66afa8",
"category": "dinner"
}
{
"meal_id": "3fa85f64-5717-4562-b3fc-2c963f66afa9",
"category": "snacks & appetizers"
}
]
}
The meal IDs retrieved from the optimal diet endpoint are meant to be used in the payload. The category here denotes the category the meal is selected under. Only those categories that the meal belongs to would be accepted. For example if a meal has ["lunch", "dinner"] categories, you can only choose from those categories, and passing another category will result in a 400 error.
Updating meal plan
Similarly you can update the meals within a daily meal plan using the PUT method, passing an updated array of meals for the day.
Listing meal plan
Once the meal plan is prepared, retrieve the meal plan using the list (GET) method, the sample response of which looks like:
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"profile_id": "string",
"day": "mon",
"meals": [
{
"category": "breakfast",
"meal": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"title": "string",
"image": "string",
"categories": [
"string"
],
"calories": 0,
"carbs": 0,
"fat": 0,
"protein": 0,
"tags": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"text": "string",
"color": "green",
"report_id": "string",
"conditions": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"effect": 0,
"override_text": "string",
"override_color": "green",
"outcome_id": "string",
"base_question_option_id": "string",
"priority": 0
}
]
}
],
"servings": 0,
"instructions": "string",
"ingredients": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"display_text": "string"
}
]
}
}
]
}
]
The maximum length of the returned response is 7, i.e. for each day of the week. Please note the meals list in the response has two fields, one representing the category that the meal was chosen for, and the other represents the meal detail. All the meal fields are retrieved, just like in the meal detail endpoint, i.e. including servings, instructions and ingredients.
