Saltar al contenido
Almendra
Esc
↑↓navegar↵abrir⌘Jvista previa

Send a meal plan to the patient

Finishes the plan, like “Finish” in the dashboard: it appears in the patient’s Almendra app and the patient gets a notification. Sending an already sent plan changes nothing.

Requires the meal_plans:write permission.

POST/meal-plans/{meal_plan_id}/send
Autorización
AuthorizationToken Bearer (API Key) · headerobligatorio

Almendra API key, bound to one professional account. Send it as Authorization: Bearer YOUR_API_KEY.

Ámbitos:meal_plans:write
Parámetros de ruta
meal_plan_idstringobligatorio

Meal plan ID

coincide con ^[0-9a-fA-F]{24}$
Respuestas
200

Meal plan sent

_idstringobligatorio
namestringobligatorio
patientstringobligatorio

Patient ID

typestringobligatorio

daily: a menu per day; flexible: the same options every day; exchange: portions per exchange group; text: meals written as free text (meals[].text); pdf: an uploaded PDF (pdfUrl).

Valores permitidos:dailyflexibleexchangetextpdf
startDatestring<date-time>
endDatestring<date-time>
sentbooleanobligatorio

Finished and visible to the patient in the Almendra app

objectivestring
pdfUrlstring
createdAtstring<date-time>obligatorio
updatedAtstring<date-time>obligatorio

Send it back as expectedUpdatedAt when editing to avoid overwriting newer changes

indicationsstring[]obligatorio

Recommendations shown to the patient with the plan

daysMealPlanDay[]obligatorio
Mostrar propiedades
Array de MealPlanDay
namestringobligatorio
isFreeDaybooleanobligatorio
caloriesKcalnumber
proteinGnumber
carbsGnumber
fatGnumber
mealsMealPlanMeal[]obligatorio
Mostrar propiedades
Array de MealPlanMeal
namestringobligatorio
timestring
commentstring
textstring

text plans: the meal written as free text by the professional

caloriesPercentagenumber

Share of the day's calories this meal targets (0–100)

proteinTargetGnumber
carbsTargetGnumber
fatTargetGnumber
optionsMealPlanOption[]obligatorio

Alternatives the patient can choose from for this meal

Mostrar propiedades
Array de MealPlanOption
namestring
foodsMealPlanFood[]obligatorio
Mostrar propiedades
Array de MealPlanFood
foodstringobligatorio

Food or recipe ID

foodNamestringobligatorio
quantitynumberobligatorio
unitstringobligatorio
exchangesMealPlanExchange[]obligatorio

Exchange portions (exchange meal plans)

Mostrar propiedades
Array de MealPlanExchange
groupstringobligatorio

Exchange group: the id of a stored group (GET /exchange-groups) or a built-in group code

quantitynumberobligatorio
excludedFoodsstring[]obligatorio

Food IDs of the group the patient should not pick

400

Invalid path parameter, query parameter or request body

successbooleanobligatorio
Valores permitidos:false
messagestringobligatorio

Same as error.message.

errorobjectobligatorio
Mostrar propiedades
statusintegerobligatorio

HTTP status code of the response.

codestringobligatorio

Machine-readable error code, stable across versions; branch on this rather than on message.

Valores permitidos:bad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictpayload_too_largeunsupported_media_typeunprocessable_entityrate_limitedinternal_errornot_implementedbad_gatewayservice_unavailablegateway_timeout
messagestringobligatorio

Human-readable explanation of what went wrong.

401

Missing or invalid API key

successbooleanobligatorio
Valores permitidos:false
messagestringobligatorio

Same as error.message.

errorobjectobligatorio
Mostrar propiedades
statusintegerobligatorio

HTTP status code of the response.

codestringobligatorio

Machine-readable error code, stable across versions; branch on this rather than on message.

Valores permitidos:bad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictpayload_too_largeunsupported_media_typeunprocessable_entityrate_limitedinternal_errornot_implementedbad_gatewayservice_unavailablegateway_timeout
messagestringobligatorio

Human-readable explanation of what went wrong.

403

The account behind the API key has no active paid plan, or the key lacks the permission this operation needs

successbooleanobligatorio
Valores permitidos:false
messagestringobligatorio

Same as error.message.

errorobjectobligatorio
Mostrar propiedades
statusintegerobligatorio

HTTP status code of the response.

codestringobligatorio

Machine-readable error code, stable across versions; branch on this rather than on message.

Valores permitidos:bad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictpayload_too_largeunsupported_media_typeunprocessable_entityrate_limitedinternal_errornot_implementedbad_gatewayservice_unavailablegateway_timeout
messagestringobligatorio

Human-readable explanation of what went wrong.

404

Meal plan not found

successbooleanobligatorio
Valores permitidos:false
messagestringobligatorio

Same as error.message.

errorobjectobligatorio
Mostrar propiedades
statusintegerobligatorio

HTTP status code of the response.

codestringobligatorio

Machine-readable error code, stable across versions; branch on this rather than on message.

Valores permitidos:bad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictpayload_too_largeunsupported_media_typeunprocessable_entityrate_limitedinternal_errornot_implementedbad_gatewayservice_unavailablegateway_timeout
messagestringobligatorio

Human-readable explanation of what went wrong.

409

The plan has nothing to send yet

successbooleanobligatorio
Valores permitidos:false
messagestringobligatorio

Same as error.message.

errorobjectobligatorio
Mostrar propiedades
statusintegerobligatorio

HTTP status code of the response.

codestringobligatorio

Machine-readable error code, stable across versions; branch on this rather than on message.

Valores permitidos:bad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictpayload_too_largeunsupported_media_typeunprocessable_entityrate_limitedinternal_errornot_implementedbad_gatewayservice_unavailablegateway_timeout
messagestringobligatorio

Human-readable explanation of what went wrong.

429

Rate limit exceeded (600 requests per 60 seconds); retry after Retry-After seconds

successbooleanobligatorio
Valores permitidos:false
messagestringobligatorio

Same as error.message.

errorobjectobligatorio
Mostrar propiedades
statusintegerobligatorio

HTTP status code of the response.

codestringobligatorio

Machine-readable error code, stable across versions; branch on this rather than on message.

Valores permitidos:bad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictpayload_too_largeunsupported_media_typeunprocessable_entityrate_limitedinternal_errornot_implementedbad_gatewayservice_unavailablegateway_timeout
messagestringobligatorio

Human-readable explanation of what went wrong.

500

Unexpected server error

successbooleanobligatorio
Valores permitidos:false
messagestringobligatorio

Same as error.message.

errorobjectobligatorio
Mostrar propiedades
statusintegerobligatorio

HTTP status code of the response.

codestringobligatorio

Machine-readable error code, stable across versions; branch on this rather than on message.

Valores permitidos:bad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictpayload_too_largeunsupported_media_typeunprocessable_entityrate_limitedinternal_errornot_implementedbad_gatewayservice_unavailablegateway_timeout
messagestringobligatorio

Human-readable explanation of what went wrong.

Pruébalo
Servidor
Autorización
Parámetros
Solicitud
curl -X POST 'https://api.almendra.io/openapi/v1/meal-plans/507f1f77bcf86cd799439011/send' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json'
Respuesta
{
  "_id": "string",
  "name": "Plan semana 1",
  "patient": "string",
  "type": "daily",
  "startDate": "2019-08-24T14:15:22Z",
  "endDate": "2019-08-24T14:15:22Z",
  "sent": true,
  "objective": "string",
  "pdfUrl": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "indications": [
    "string"
  ],
  "days": [
    {
      "name": "Lunes",
      "isFreeDay": true,
      "caloriesKcal": 0,
      "proteinG": 0,
      "carbsG": 0,
      "fatG": 0,
      "meals": [
        {
          "name": "Desayuno",
          "time": "08:00",
          "comment": "string",
          "text": "string",
          "caloriesPercentage": 0,
          "proteinTargetG": 0,
          "carbsTargetG": 0,
          "fatTargetG": 0,
          "options": [
            {
              "name": "Opción 1",
              "foods": [
                {
                  "food": "string",
                  "foodName": "Avena en hojuelas",
                  "quantity": 40,
                  "unit": "g"
                }
              ]
            }
          ],
          "exchanges": [
            {
              "group": "string",
              "quantity": 2,
              "excludedFoods": [
                "string"
              ]
            }
          ]
        }
      ]
    }
  ]
}

¿No encuentras lo que buscas?

Nuestro equipo responde en menos de 1 día hábil, de lunes a viernes de 9:30 a 18:00 (GMT-5).

Escríbenos

¿Te ha resultado útil esta página?