Nutrition Preferences
Function-calling namespace: nutritionPreferences
- Base URL:
https://api.aivida.in - Engine endpoint:
POST /api - Auth: Stack token middleware enabled in
optionalmode. - Send token in header:
x-stack-access-token: <access_token>(orAuthorization: Bearer <access_token>). - In
optionalmode: no token is allowed; invalid token is rejected with401.
getByPatientId
Source: backend/endpoints/nutrition-preferences/get-by-patient-id
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
patientId | string | Yes | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "nutritionPreferences",
"apiName": "getByPatientId",
"data": {
"patientId": "patient_123"
}
}'Example Response
{ "status": "ok", "data": {} }upsert
Source: backend/endpoints/nutrition-preferences/upsert
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
patientId | string | Yes | - |
dailyCalorieGoal | integer | Yes | - |
dailyWaterGoalMl | integer | No | - |
isReminderEnabled | boolean | No | - |
reminderFrequency | string | No | - |
meals | array<object> | Yes | - |
Nested Field Structures
meals item
| Field | Type | Required | Constraints |
|---|---|---|---|
mealType | string | Yes | - |
isEnabled | boolean | No | - |
mealTime | string | Yes | format: HH:mm |
caloriePercentage | number | No | - |
reminderEnabled | boolean | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "nutritionPreferences",
"apiName": "upsert",
"data": {
"patientId": "patient_123",
"dailyCalorieGoal": 1,
"meals": [
{
"mealType": "general",
"isEnabled": true,
"mealTime": "10:30",
"caloriePercentage": 1,
"reminderEnabled": true
}
]
}
}'Example Response
{ "status": "ok", "data": {} }