Skip to main content

REST API: Products and Tools

How to create, update, and delete ingredients/products and materials/tools

Gustavo Vera avatar
Written by Gustavo Vera
Updated today

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 index

  • rows (int, required) – number of rows to return

  • filter (string, optional) – text filter

  • types (array[string], optional) – family IDs to filter by

  • marked (boolean, optional) – only marked products

  • hidden (boolean, optional) – only hidden products

  • used (boolean, optional) – only products used in recipes

  • notUsed (boolean, optional) – only unused products

  • withPrice (boolean, optional) – only products with price

  • withNoPrice (boolean, optional) – only products without price

  • withVendor (boolean, optional) – only products linked to vendors

  • withNoVendor (boolean, optional) – products without vendors

  • withUnits (boolean, optional) – include unit info

  • withTypes (boolean, optional) – include product families

  • withCost (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 identifier

  • descr: product name

  • color: color code (only for ingredients)

  • type: 0 = ingredient/product, 1 = material/tool

  • hasData: true if used in a recipe or dish

  • tag: 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 = true

  • averageCost = false

  • fixedCost = 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}/cost

Body

{   "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=0 for ingredients, type=1 for tools.

  • Cost updates propagate automatically to linked elaborations.

  • Include rememberme and order headers in all requests.

Did this answer your question?