Get Today's Summary (v1)
Method & Path
GET /api/v1/nutrition/portal/:slug/today
Description
Retrieves a comprehensive summary of the client's current day, including their active plan meals, food diary, and calorie/macro progress.
Authentication
Required: Portal token (Bearer authentication)
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer <portal_token> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| slug | string | Yes | Specialist's portal slug |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| date | string | No | Date in YYYY-MM-DD format (default: today) |
Response 200 OK
{
"date": "2024-01-15",
"plan": {
"id": "507f1f77bcf86cd799439013",
"name": "خطة إنقاص الوزن",
"dailyCalories": 1800,
"macros": {
"protein": 120,
"carbs": 180,
"fats": 60
},
"todaysMeals": [
{
"id": "meal-1",
"name": "الفطور",
"time": "08:00",
"calories": 400,
"items": [
{ "name": "بيض مسلوق", "quantity": "2 حبة", "calories": 140 },
{ "name": "خبز أسمر", "quantity": "شريحة", "calories": 80 }
]
},
{
"id": "meal-2",
"name": "الغداء",
"time": "13:00",
"calories": 600,
"items": [...]
}
]
},
"diary": {
"id": "507f1f77bcf86cd799439014",
"date": "2024-01-15",
"meals": [...],
"totalCalories": 850,
"totalProtein": 60,
"totalCarbs": 80,
"totalFats": 30,
"waterIntake": 1500,
"mood": "good"
},
"targets": {
"dailyCalories": 1800,
"macros": {
"protein": 120,
"carbs": 180,
"fats": 60
}
},
"consumed": {
"calories": 850,
"protein": 60,
"carbs": 80,
"fats": 30
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
| date | string | The date in YYYY-MM-DD format |
| plan | object | Active plan with today's meals (null if no plan) |
| diary | object | Food diary for the day (null if no entries) |
| targets | object | Daily targets from plan or estimated |
| consumed | object | Total consumed today |
Calorie Calculation
If no active plan exists, the API estimates daily calorie needs using the Mifflin-St Jeor equation based on the client's profile (weight, height, age, gender) with a moderate activity multiplier.
Common Errors
- 401 Unauthorized: Missing or invalid token
- 403 Forbidden: Password change required
- 404 Not Found: Invalid portal slug