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

Create an exchange group

Adds an exchange group to the account, usable in exchange meal plans. The built-in groups of the exchange systems are edited in the dashboard.

Requires the library:write permission.

POST/exchange-groups
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
Cuerpo de la solicitud
application/json
namestringobligatorio
longitud mín. 1 · longitud máx. 80
descriptionstring
longitud máx. 500
colorstring
coincide con ^#[0-9a-fA-F]{6}$
foodsIngredientInput[]obligatorio

Foods of the group and the quantity that makes one exchange

máx. 200 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
Respuestas
201

Exchange group created

_idstringobligatorio
namestringobligatorio
descriptionstring
colorstring
categorystring
replacesDefaultGroupstring

Id of the built-in group this one replaces or hides (e.g. CENAN-01)

hidesDefaultGroupbooleanobligatorio

True when this entry only hides the built-in group replacesDefaultGroup

foodsRecipeIngredient[]obligatorio

Foods in the group and the quantity that makes one exchange

Mostrar propiedades
Array de RecipeIngredient
foodstring

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

foodNamestringobligatorio
quantitynumberobligatorio
unitstringobligatorio
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

A food of the group 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
Cuerpoapplication/json
Solicitud
curl -X POST 'https://api.almendra.io/openapi/v1/exchange-groups' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Frutas",
  "description": "string",
  "color": "#f59e0b",
  "foods": [
    {
      "food": "507f1f77bcf86cd799439011",
      "quantity": 100,
      "unit": "g"
    }
  ]
}'
Respuesta
{
  "_id": "string",
  "name": "Cereales sin grasa",
  "description": "string",
  "color": "string",
  "category": "string",
  "replacesDefaultGroup": "string",
  "hidesDefaultGroup": true,
  "foods": [
    {
      "food": "string",
      "foodName": "string",
      "quantity": 0,
      "unit": "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?