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

Edit a recipe

Edits one of the account’s recipes. New ingredients or portions recompute the nutrition. If the recipe is already used in a meal plan, template or exchange group and its nutrition changes, the answer is a copy with a new _id that replaces it from now on, and existing plans keep the old values.

Requires the library:write permission.

PUT/recipes/{recipe_id}
Autorización
AuthorizationToken Bearer (API Key) · headerobligatorio

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

Ámbitos:library:write
Parámetros de ruta
recipe_idstringobligatorio

Recipe ID

coincide con ^[0-9a-fA-F]{24}$
Cuerpo de la solicitud
application/json
namestring
longitud mín. 1 · longitud máx. 120
portionsinteger
mín. 1 · máx. 100
ingredientsIngredientInput[]
mín. 1 elementos · máx. 60 elementos
Mostrar propiedades
Array de IngredientInput
foodstringobligatorio

Food ID (GET /foods)

coincide con ^[0-9a-fA-F]{24}$
quantitynumberobligatorio
mín. 0
unitstring

Grams (g, the default) or one of the food's measures (measures[].description in GET /foods/{food_id}).

longitud mín. 1
instructionsstring[]
mín. 1 elementos · máx. 60 elementos
tagsstring[]
máx. 30 elementos
preparationTimeMinutesinteger
mín. 0
cookingTimeMinutesinteger
mín. 0
difficultystring
Valores permitidos:easymediumhard
isPublicboolean
Respuestas
200

Recipe edited

_idstringobligatorio
namestringobligatorio
portionsnumber
preparationTimeMinutesnumber
cookingTimeMinutesnumber
caloriesKcalnumber
proteinGnumber
carbsGnumber
fatGnumber
tagsstring[]obligatorio
imageUrlstring
isPublicbooleanobligatorio

Shared with every Almendra account

isDraftbooleanobligatorio

Still being written (not yet offered in meal plans)

createdByThisAccountbooleanobligatorio
difficultystring
ingredientsRecipeIngredient[]obligatorio
Mostrar propiedades
Array de RecipeIngredient
foodstring

Food ID (left out in other accounts' public recipes)

foodNamestringobligatorio
quantitynumberobligatorio
unitstringobligatorio
instructionsstring[]obligatorio
nutrientsobjectobligatorio

Every other nutrient the food has, per 100 g, keyed by name and unit (sodium_mg, vitaminB12_ug, …).

measuresFoodMeasure[]obligatorio

Household measures and their weight in grams, including the account's own measures for this food. A meal plan's unit is one of these (or grams).

Mostrar propiedades
Array de FoodMeasure
amountnumberobligatorio
descriptionstringobligatorio
gramsnumberobligatorio
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

Not one of the account's recipes, or an ingredient was 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.

415

Request body sent without Content-Type: application/json

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
Cuerpoapplication/json
Solicitud
curl -X PUT 'https://api.almendra.io/openapi/v1/recipes/507f1f77bcf86cd799439011' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Quinua con pollo",
  "portions": 2,
  "ingredients": [
    {
      "food": "507f1f77bcf86cd799439011",
      "quantity": 100,
      "unit": "g"
    }
  ],
  "instructions": [
    "string"
  ],
  "tags": [
    "string"
  ],
  "preparationTimeMinutes": 0,
  "cookingTimeMinutes": 0,
  "difficulty": "easy",
  "isPublic": true
}'
Respuesta
{
  "_id": "string",
  "name": "Quinua con pollo",
  "portions": 0,
  "preparationTimeMinutes": 0,
  "cookingTimeMinutes": 0,
  "caloriesKcal": 0,
  "proteinG": 0,
  "carbsG": 0,
  "fatG": 0,
  "tags": [
    "string"
  ],
  "imageUrl": "string",
  "isPublic": true,
  "isDraft": true,
  "createdByThisAccount": true,
  "difficulty": "string",
  "ingredients": [
    {
      "food": "string",
      "foodName": "string",
      "quantity": 0,
      "unit": "string"
    }
  ],
  "instructions": [
    "string"
  ],
  "nutrients": {
    "fiber_g": 0,
    "sodium_mg": 74,
    "iron_mg": 1
  },
  "measures": [
    {
      "amount": 1,
      "description": "taza",
      "grams": 240
    }
  ]
}

¿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?