List, create and delete products (ingredients) and tools (materials), and update their cost.
GET /listIngredientsPaged
GET /listMaterialsPaged
POST /ingredient
POST /material
DELETE /ingredient/{idComponent}
DELETE /material/{idComponent}
PUT /ingredient/{idComponent}/cost
PUT /material/{idComponent}/cost
Before you start
Base URL: https://app.tspoonlab.com/recipes/api
Headers
rememberme· required — Session token returned by the login.order· optional — Cost center id (Cost centers). Defaults to the user's active cost center. Codes, costs and stock levels are read from and saved to this cost center.
Login — Returns the token as plain text.
curl https://app.tspoonlab.com/recipes/api/login \
-d [email protected] \
-d password=XXXXXXX
Permissions — Listing requires permission to view products or tools; creating and deleting, permission to add or delete products or tools; updating the cost, permission to edit them.
Responses may include fields other than the documented ones. Use only the documented fields.
List products and tools
/listIngredientsPaged lists products and /listMaterialsPaged lists tools.
GET /listIngredientsPaged
GET /listMaterialsPaged
Query parameters
startinteger · required — Position of the first row, starting at 0.rowsinteger · required — Number of rows to return.filterstring · optional — Text to search in the name, alternative name or code. WithwithTypes=true, also in category names.typesarray · optional — Category ids; repeat the parameter for each one. Products must have all of them.markedboolean · optional —truereturns only marked products. Defaults tofalse.hiddenboolean · optional —truereturns only hidden products;false, only visible ones. Defaults tofalse.usedboolean · optional —truereturns only products used in some recipe or dish.notUsedboolean · optional —truereturns only products not used in any recipe or dish.withPriceboolean · optional —truereturns only products with a cost in the cost center.withNoPriceboolean · optional —truereturns only products without a cost in the cost center.withVendorboolean · optional —truereturns only products with a supplier in the cost center.withNoVendorboolean · optional —truereturns only products without any supplier in the cost center.withUnitsboolean · optional —trueincludes the unit. Defaults tofalse.withTypesboolean · optional —trueincludes the categories. Defaults tofalse.withCostboolean · optional —trueincludes the cost. Defaults tofalse.
Example
curl "https://app.tspoonlab.com/recipes/api/listIngredientsPaged?start=0&rows=50&withUnits=true&withCost=true" \
-H "rememberme: $TOKEN"
Response
[
{
"id": "3515834441676562996102040001",
"descr": "Plum tomato",
"codi": "P-0102",
"color": 15158332,
"type": 0,
"hasData": true,
"tag": null,
"tagComment": null,
"idUnit": "3515834441676562996102040002",
"unit": "kg",
"cost": 1.35,
"listComponentTypes": null,
"listComponentTypesOthers": null
}
]
idstring — Product id.descrstring — Name.codistring — Code in the cost center.colorinteger — Colour (RGB) of its first category.0if it has no categories.typeinteger —0product ·2tool.hasDataboolean — Whether it is used in some recipe or dish.taginteger — Mark:1OK ·2more info needed ·3error.nullif not marked.tagCommentstring — Comment on the mark.idUnit,unitstring — Product unit. Only withwithUnits.costnumber — Cost per unit in the cost center. Only withwithCost.listComponentTypesarray — Basic categories, each withidanddescr. Only withwithTypes.listComponentTypesOthersarray — Property or cost categories, with the same fields. Only withwithTypes.
Create a product or tool
/ingredient creates a product and /material a tool. Returns its id.
POST /ingredient
POST /material
Body
descrstring · required — Name.idUnitstring · required — Product unit id.listComponentTypesarray · required — Categories, each with itsid. Send[]if there are none.listEquivalencesarray · required — Equivalences with other units, up to 4. Send[]if there are no equivalences.altDescrstring · optional — Alternative name, usually the commercial one.codistring · optional — Code in the cost center.barcodestring · optional — Barcode in the cost center.includeInOrderboolean · optional —trueincludes it in orders. Defaults tofalse.averageCostboolean · optional —true: the cost is the average of last month's purchases.fixedCostboolean · optional —true: the cost is fixed. If neither is sent, the last purchase cost is used.costnumber · optional — Cost per unit in the cost center. Ignored without permission to view costs.minStock,maxStocknumber · optional — Minimum and maximum stock in the cost center.caducitynumber · optional — Shelf life in days.listStoresarray · optional — Stores in the cost center where it is kept, each with itsid. Ignored without permission to edit stores.
Each equivalence:
idUnitFromstring · required — Id of the other unit.quantityTonumber · required — Equivalent quantity.invertedboolean · optional —false: 1idUnitFrom=quantityToproduct units.true: 1 product unit =quantityToidUnitFrom. Defaults tofalse.
Example
curl https://app.tspoonlab.com/recipes/api/ingredient \
-H "rememberme: $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"descr": "Plum tomato",
"idUnit": "3515834441676562996102040002",
"listComponentTypes": [ { "id": "3515834441676562996102040003" } ],
"listEquivalences": [ { "idUnitFrom": "3515834441676562996102040004", "quantityTo": 0.15 } ],
"codi": "P-0102",
"includeInOrder": true,
"cost": 1.35
}'
Response
{ "id": "3515834441676562996102040001" }Delete a product or tool
Deletion is permanent.
DELETE /ingredient/{idComponent}
DELETE /material/{idComponent}Path parameters
idComponentstring · required — Product or tool id.
Example
curl -X DELETE https://app.tspoonlab.com/recipes/api/ingredient/3515834441676562996102040001 \
-H "rememberme: $TOKEN"
Response — No content.
Update the cost
Changes the cost in the cost center and, if it changed, recalculates the cost of the recipes, dishes, menus and events in that cost center that use it.
PUT /ingredient/{idComponent}/cost
PUT /material/{idComponent}/costPath parameters
idComponentstring · required — Product or tool id.
Body
valuenumber · required — New cost per unit. Withnull, or if omitted, the cost is removed.
Example
curl -X PUT https://app.tspoonlab.com/recipes/api/ingredient/3515834441676562996102040001/cost \
-H "rememberme: $TOKEN" \
-H "Content-Type: application/json" \
-d '{"value": 1.42}'
Response — No content.
Need help? Message us from the support chat in the bottom-right corner.
