در حال بارگذاری…
Add a meal to a diet plan.
| Permission | Description |
|---|---|
diet_plan_meals.create | Create meals for your diet plans |
diet_plans.update | Update your own or your trainee's diet plans |
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
diet-plan-id | int | Yes | ID of the diet plan | 12 |
| Name | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Title of the meal (max 255) |
ingredients | string | Yes | Ingredients (max 2000) |
description | string | No | Optional description (max 2000) |
protein | int | Yes | Protein in grams |
carb | int | Yes | Carbohydrate in grams |
fat | int | Yes | Fat in grams |
calories | int | Yes | Calories |
meal_index | int | Yes | Index of this option within its category (row position) |
category_index | int | Yes | Category of the meal (table position) |
POST /api/v1/training/diet-plans/12/meals
{
"title": "Chicken and rice",
"ingredients": "200g chicken breast, 150g rice",
"protein": 45,
"carb": 60,
"fat": 8,
"calories": 520,
"meal_index": 1,
"category_index": 2
}
{
"data": { /* diet plan meal resource */ }
}
When the caller is not the plan's owner (a trainer editing a trainee's plan), the owner receives a
DietPlanUpdatedNotification.
| Status | Description | Reference |
|---|---|---|
| 422 | Validation error | Validation error |
| 401 | Unauthorized | Authentication error |
| 403 | Forbidden (no permission) | Permission error |
| 404 | Not found | Not-found error |