Skip to main content

REST API: Recipes and Dishes

How to access intermediate (recipes) and final (dishes) elaborations and their details

Gustavo Vera avatar
Written by Gustavo Vera
Updated over 3 weeks ago

1. Prepared Products

Prepared products are items produced internally from base ingredients.

There are two main types:

  • Recipes (Intermediate preparations): produced in-house and later used as components in other recipes or dishes.

  • Dishes (Final preparations): finished items sold or served to customers.


1.1 REST API: Login

To make API calls, first authenticate using the login endpoint.
The login returns a token, which must be added to 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

Use the token in your headers:

curl -X PUT -v -H "$(cat rememberme.txt)" "$url/integration/call"

1.2 Select a Cost Center / Restaurant

Requests below refer to a specific cost center (typically a restaurant).

To retrieve cost centers and their IDs, see:
REST API: Get a list of cost centers

Once you have the identifier, include it in your headers:

rememberme:aGVucnkudXBzYWxsLmRAZXXXXXXXXXXXXXXXXXX order:351583444167656299610202XXXXXXXXXXXX

1.3 List all elaborated products

There are two main calls:

GET https://app.tspoonlab.com/recipes/api/listRecipesPaged GET https://app.tspoonlab.com/recipes/api/listDishesPaged

Parameters

  • start (int, required) – first row index

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

  • filter (string, optional) – text filter

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

  • marked (boolean, optional) – only marked items

  • hidden (boolean, optional) – only hidden items

  • withTypes (boolean, optional) – include product families

  • withDetail (boolean, optional) – include recipe details

Response

class EntityBaseImages {  String id;  String descr;  String codi;  boolean hasData;  Short tag;  String tagComment;  String altDescr;  List<EntityBaseDescr> listComponentTypes;  List<ComponentDetail> listComponentDetail; }

Notes

  • hasData: true if the elaboration is used in another recipe or dish.

  • tag: (1=Ok, 2=More Info, 3=Error)

  • listComponentTypes: returned when withTypes=true

  • listComponentDetail: returned when withDetail=true


1.4 Get a Recipe (Intermediate elaboration)

Endpoint

GET https://app.tspoonlab.com/recipes/api/recipe/{idRecipe}

Response

class ComponentCompound {  String id;  String descr;  String altDescr;  Double cost;  List<ComponentDetail> listComponentDetail;  List<ComponentService> listComponentService;  String process; }  class ComponentService {  String id;  String idUnit;  Double quantity;  String unit; }  class ComponentDetail {  String id;  String idComponent;  String codeComponent;  String descr;  String altDescr;  Double quantity;  Double quantityGross;  String unit;  String idUnit;  String use;  String comment;  Double cost;  int type; }

Notes

  • cost: cost to produce the amount defined in listComponentService.

  • process: steps of the recipe (each line separated by \n).

  • listComponentDetail: ingredients used in the recipe.

  • quantityGross: raw quantity before trimming or processing.

  • type:

    • 0 = Ingredient/Product

    • 1 = Recipe (intermediate)

    • 2 = Material/Tool

    • 3 = Dish (final)


1.5 Get a Dish (Final elaboration)

Endpoint

GET https://app.tspoonlab.com/recipes/api/dish/{idDish}

Same structure as ComponentCompound, plus:

private List<EntityBaseData> listRecipeCenters;  class EntityBaseData {  String id;      // Relationship ID (dish ↔ recipe book)  String idAux;   // Recipe book ID  String descr;   // Recipe book description }

1.6 Data structure for creating or deleting recipes and dishes

Used when creating or deleting elaborations.

class NewComponentComplex {  String descr;  String altDescr;  List<NewComponentUnit> listComponentUnits;   Double minStock;  Double maxStock;  Double minProduction;  Double multProduction;   List<NewComponentType> listComponentTypes;  List<NewComponentStore> listStores;   String codi;  boolean includeInOrder;  boolean averageCost;  boolean fixedCost;  boolean fromVendor;   String origen;  Double caducity;  String idPartida;  Boolean inLabel;  Boolean inPlanning;  Short typeConservation;  Double storageTemperature;  Double storageTemperatureAux;  Short typeTemperature;  Double iva;  String barcode; }

Subclasses

class NewComponentUnit {  double quantity;  String idUnit;  Integer position; }  class NewComponentType {  String id; // Family ID }  class NewComponentStore {  String id; // Store ID }

Conservation and temperature types

// Conservation type 0 = Refrigerator 1 = Freezer 2 = Dry 3 = Hot  // Temperature condition 0 = Equals 1 = LessThan 2 = GreaterThan 3 = Between

1.7 Create a Recipe

Endpoint

POST https://app.tspoonlab.com/recipes/api/recipe

Body

NewComponentComplex

1.8 Create a Dish

Endpoint

POST https://app.tspoonlab.com/recipes/api/dish

Body

NewComponentComplex {   List<NewRecipeCenter> listRecipeCenters; }  class NewRecipeCenter {   String id;             // null when creating   String idRecipeCenter; // recipe book ID }

1.9 Delete a Recipe

DELETE https://app.tspoonlab.com/recipes/api/recipe/{idRecipe}

1.10 Delete a Dish

DELETE https://app.tspoonlab.com/recipes/api/dish/{idDish}

1.11 Get Recipe/Dish Details

Endpoints

GET https://app.tspoonlab.com/recipes/api/recipe/{idRecipe} GET https://app.tspoonlab.com/recipes/api/dish/{idDish}

Response

class ComponentDetail {  String id;  String idComponent;  String descr;  String altDescr;  Double quantity;  Double quantityGross;  String idUnit;  String unit;  String idUse;  String use;  String comment;  Double cost;  String codeComponent;  String date;  List<ComponentAllergy> listAllergies; }  class ComponentAllergy extends EntityBaseDescr {  String id;  String descr;  String idAllergy;  String codi;  boolean calculated; // derived from sub-ingredients  boolean traces;     // trace presence }

1.12 Modify Recipe/Dish Details

Endpoints

PUT https://app.tspoonlab.com/recipes/api/recipe/{idRecipe} PUT https://app.tspoonlab.com/recipes/api/dish/{idDish}

Body

class NewComponentDetailsWrapper {  List<NewComponentDetail> components; }  class NewComponentDetail {  String id;           // null when adding  String idComponent;  // component ID  String idUnit;       // unit ID  String idUse;        // cut/subproduct ID  Double quantity;     // quantity used  boolean qs;          // "quantity sufficient" flag  String comment;  int position; }

Notes

  • Recipes (intermediate) and Dishes (final) share similar data models.

  • Always include correct unit IDs to ensure consistent conversions.

  • Use HTTPS and authentication headers in all calls.

Did this answer your question?