1. Basic Products
Basic products are the foundation of all recipes and dishes — the elements that make up the full gastronomic offer.
Two main types exist:
Ingredients / Products: consumable items — either raw ingredients or pre-made goods purchased from suppliers.
Materials / Tools: non-consumable items used during preparation or service.
1.1 REST API: Login
To make API calls, you must first authenticate via the login endpoint.
The response will return a token to include in all subsequent requests.
Example (cURL)
[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
Include the token in your headers for all further calls:
curl -X PUT -v -H "$(cat rememberme.txt)" $url/integration/call
1.2 Select a Cost Center / Restaurant
Requests below apply to a specific cost center (usually a restaurant).
Retrieve cost center IDs first:
REST API: Get list of cost centers
Then include the cost center ID (idOrderCenter) in the headers:
rememberme:aGVucnkudXBzYWxsLmRAZXXXXXXXXXXXXXXXXXX order:351583444167656299610202XXXXXXXXXXXX
1.3 List all Basic Products
You can list ingredients or materials using these endpoints:
GET https://app.tspoonlab.com/recipes/api/listIngredientsPaged GET https://app.tspoonlab.com/recipes/api/listMaterialsPaged
Parameters
start(int, required) – starting row indexrows(int, required) – number of rows to returnfilter(string, optional) – text filtertypes(array[string], optional) – family IDs to filter bymarked(boolean, optional) – only marked productshidden(boolean, optional) – only hidden productsused(boolean, optional) – only products used in recipesnotUsed(boolean, optional) – only unused productswithPrice(boolean, optional) – only products with pricewithNoPrice(boolean, optional) – only products without pricewithVendor(boolean, optional) – only products linked to vendorswithNoVendor(boolean, optional) – products without vendorswithUnits(boolean, optional) – include unit infowithTypes(boolean, optional) – include product familieswithCost(boolean, optional) – include product cost
Response
class EntityBaseImagesColor { String id; String descr; Long color; short type; String codi; boolean hasData; Short tag; String tagComment; }Notes
id: product identifierdescr: product namecolor: color code (only for ingredients)type: 0 = ingredient/product, 1 = material/toolhasData: true if used in a recipe or dishtag: null or (1=OK, 2=More Info, 3=Error)tagComment: associated tag comment
When withUnits=true, returns:
String idUnit; // Unit ID String unit; // Unit description
When withCost=true, returns:
Double cost; // Product cost per unit
When withTypes=true, returns:
List<EntityBaseDescr> listComponentTypes; // Main families List<EntityBaseDescr> listComponentTypesOthers; // Property or cost-related families class EntityBaseDescr { String id; String descr; }1.4 Create a Product
Two endpoints are available:
POST https://app.tspoonlab.com/recipes/api/ingredient POST https://app.tspoonlab.com/recipes/api/material
Request Body
class NewComponentBase { String descr; // Product name (kitchen) String altDescr; // Alternative or commercial name String idUnit; // Unit ID List<NewComponentType> listComponentTypes; boolean includeInOrder; boolean averageCost; boolean fixedCost; List<NewComponentStore> listStores; Double cost; // Cost per unit Double minStock; Double maxStock; String codi; // Internal code Double caducity; // Shelf life (days) String barcode; // Barcode } class NewComponentType { String id; // Family ID } class NewComponentStore { String id; // Store ID }Recommended default values
includeInOrder = trueaverageCost = falsefixedCost = false
1.6 Delete a Product
Two endpoints:
DELETE https://app.tspoonlab.com/recipes/api/ingredient/{idComponent} DELETE https://app.tspoonlab.com/recipes/api/material/{idComponent}No body or response.
A product cannot be deleted if it’s currently used in recipes, dishes, or active suppliers.
1.7 Update Product Cost
Two endpoints:
PUT https://app.tspoonlab.com/recipes/api/ingredient/{idComponent}/cost PUT https://app.tspoonlab.com/recipes/api/material/{idComponent}/costBody
{ "value": 5.20 }Once the cost is updated, tSpoonLab automatically recalculates the cost of all dependent recipes and dishes.
Notes
Always authenticate before any request.
type=0for ingredients,type=1for tools.Cost updates propagate automatically to linked elaborations.
Include
remembermeandorderheaders in all requests.