EndpointsNutrition Preferences

Nutrition Preferences

Function-calling namespace: nutritionPreferences

  • Base URL: https://api.aivida.in
  • Engine endpoint: POST /api
  • Auth: Stack token middleware enabled in optional mode.
  • Send token in header: x-stack-access-token: <access_token> (or Authorization: Bearer <access_token>).
  • In optional mode: no token is allowed; invalid token is rejected with 401.

getByPatientId

Source: backend/endpoints/nutrition-preferences/get-by-patient-id

Input Fields

FieldTypeRequiredConstraints
patientIdstringYes-

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

FieldTypeRequiredConstraints
patientIdstringYes-
dailyCalorieGoalintegerYes-
dailyWaterGoalMlintegerNo-
isReminderEnabledbooleanNo-
reminderFrequencystringNo-
mealsarray<object>Yes-

Nested Field Structures

meals item

FieldTypeRequiredConstraints
mealTypestringYes-
isEnabledbooleanNo-
mealTimestringYesformat: HH:mm
caloriePercentagenumberNo-
reminderEnabledbooleanNo-

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": {} }