1. Overview
tSpoonLab stores nutritional information linked to ingredients/products and can calculate nutritional values for prepared (recipe) or final (dish) products.
The parameters we consider
Parameter | Description |
Energy (Kcal / kJ) | Calculated or entered manually |
Fats / Saturated | g per 100g or total |
Carbohydrates / Sugars | g per 100g or total |
Proteins | g per 100g or total |
Fiber | g per 100g or total |
Salt | g per 100g or total |
Per 100 g
For ingredients and products, nutritional values must always be expressed per 100 g.
This standard ensures consistent comparison across ingredients, recipes, and dishes.
For recipes or dishes, nutritional data can also be calculated per 100 g, either:
Manually assigned, when cooking processes (e.g., frying, baking) modify the nutritional composition, or
Automatically calculated based on the ingredients used.
Energy conversion
Energy expressed in kJ is automatically calculated from Kcal:
1 Kcal = 4.184 kJ
If needed, Kcal can be calculated from macronutrients using:
Kcal = fat * 9 + carbohydrates * 4 + proteins * 4 + fiber * 2
1.1 REST API: Login
Authenticate first to receive a token for all subsequent requests.
[email protected] password=XXXXXXX url=https://app.tspoonlab.com/recipes/api authenticate="username=$username&password=$password" echo -n 'rememberme:' > rememberme.txt curl -v --data "$authenticate" "$url/login" >> rememberme.txt
Use the token in every request:
curl -X PUT -v -H "$(cat rememberme.txt)" $url/integration/call
1.2 Select a Cost Center / Restaurant
Most requests require a cost center context (usually a restaurant).
Retrieve cost center IDs using:
REST API: Get Cost Centers List
Include the identifier in the headers:
rememberme:aGVucnkudXBzYWxsLmRAZXXXXXXXXXXXXXXXXXX order:351583444167656299610202XXXXXXXXXXXX
1.3 Assign Nutritional Information to a Product
Use the appropriate endpoint depending on the component type:
PUT https://www.tspoonlab.com/recipes/api/ingredient/{idComponent}/nutritional PUT https://www.tspoonlab.com/recipes/api/recipe/{idComponent}/nutritional PUT https://www.tspoonlab.com/recipes/api/dish/{idComponent}/nutritional
Request body
class NewComponentNutritional { Double energy; Double fat; Double saturated; Double proteins; Double carbohydrates; Double sugar; Double salt; Double fiber; Boolean nutritionalPercent; Boolean nutritionalUnitari; String idComponentUnitNutritional; }
Parameters
nutritionalPercent = true
→ values expressed per 100 g (mandatory for base ingredients)nutritionalUnitari = true
→ values expressed per recipe/dish unitIf both are null or false → values apply to the total preparation
idComponentUnitNutritional
→ ID of the recipe/dish unit whennutritionalUnitari = true
1.4 Calculate Nutritional Information
You can request a nutritional calculation for any recipe or dish:
GET https://www.tspoonlab.com/recipes/api/recipe/{idComponent}/nutritional GET https://www.tspoonlab.com/recipes/api/dish/{idComponent}/nutritional
Add the following query parameters:
Parameter | Description |
|
|
|
|
| ID of the recipe/dish unit (if |
Examples:
?percent=false&unitari=false&idComponentUnit=null → total ?percent=true&unitari=false&idComponentUnit=null → per 100 g ?percent=false&unitari=true&idComponentUnit=XXXXXX → per unit
Response
class NutritionalInfo { Double energy; Double carbohydrates; Double sugar; Double fat; Double saturated; Double proteins; Double salt; Double fiber; boolean nutritionalPercent; boolean nutritionalUnitari; String idComponentUnitNutritional; List<EntityBaseQuantity> listIncomplete; List<EntityBaseQuantity> listNoInfo; List<EntityBaseQuantity> listNoInfoCarbohydrates; List<EntityBaseQuantity> listNoInfoSugar; List<EntityBaseQuantity> listNoInfoFat; List<EntityBaseQuantity> listNoInfoSaturated; List<EntityBaseQuantity> listNoInfoProteins; List<EntityBaseQuantity> listNoInfoSalt; List<EntityBaseQuantity> listNoInfoFiber; List<EntityBaseQuantity> listNoInfoEnergy; }
Notes
energy
corresponds to Kcal; kJ are calculated automatically.If an ingredient quantity cannot be converted to kilograms, the system lists it under listIncomplete.
If any nutritional parameter (e.g. fat, protein) is missing for one or more ingredients, the corresponding field will return null and those components will appear in the relevant listNoInfoX list (e.g.
listNoInfoFat
).nutritionalPercent = true
→ calculation per 100 gnutritionalUnitari = true
→ calculation per unit (unit ID inidComponentUnitNutritional
)Otherwise, the calculation applies to the entire recipe/dish.