1. How families work
Families allow you to classify products in tSpoonLab. There are separate classifications for:
Ingredients / Products
Recipes / Intermediate elaborations
Materials / Tools
Dishes / Final elaborations
Stores – sub-classifications that help organize inventories (e.g., shelves inside a store). Can be assigned to any product type.
Production – families used to group productions by execution order or batch. Can be assigned to recipes and dishes.
Additionally, a family may be flagged as:
Nutritional property (e.g., healthy, vegan), or
Cost / Revenue concept (e.g., food, beverage).
1.1 REST API: Login
Authenticate first; the login returns a token for all subsequent requests.
[email protected] password=XXXXXXX url=https://www.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 later calls:
curl -X PUT -v -H "$(cat rememberme.txt)" $url/integration/call
1.2 Select a Cost Center / Restaurant
Most calls run in the context of a cost center (restaurant). Retrieve the IDs and add the header:
rememberme: <token> order: <idOrderCenter>
1.3 List families
Endpoint
GET https://www.tspoonlab.com/recipes/api/listTypesPagedEx?filter=&rows=50&start=0&type=
Query params
filter
(string, optional) – text filterrows
,start
(int, required) – paginationtype
(int, required) – family domain:0
= Ingredients / Products1
= Recipes / Intermediates2
= Materials / Tools3
= Dishes / Finals5
= Store families8
= Production families
Response
class TypeComponent { private String id; private String descr; short type; Long color; String codi; Boolean costBinded; // cost/revenue family Boolean propertyBinded; // nutritional property family }
color
applies to ingredient families (type0
).codi
is the family code (if defined).costBinded
/propertyBinded
indicate special-purpose families.
1.4 Get a family (with assigned products)
Endpoint
GET https://www.tspoonlab.com/recipes/api/type/{idFamily}/num/{numComponents}
idFamily
: family IDnumComponents
: number of assigned products to include
Response
class Type extends EntityBaseDescr { String id; String descr; short type; String color; String codi; Boolean costBinded; Boolean propertyBinded; List<ComponentType> listComponent; // first N assignments } class ComponentType { String id; // assignment ID (family ↔ product) String descr; // product name int type; // 0=ingredient, 1=recipe, 2=material, 3=dish Long color; // ingredient color (if applicable) String idComponent; // product ID }
To page through all assigned products:
GET https://www.tspoonlab.com/recipes/api/type/{idFamily}/components/paged?filter=&rows=20&start=0
1.5 Create a family
Endpoint
POST https://www.tspoonlab.com/recipes/api/type
Body
class NewType { String descr; String comment; String codi; short type; // domain (see 1.3) String color; String idParent; // optional parent family Boolean costBinded; Boolean propertyBinded; }
Response
class IdWrapper { String id; }
1.6 Update a family
Endpoint
PUT https://www.tspoonlab.com/recipes/api/type/{idFamily}
Body: same as NewType
.
Returns no body; HTTP error on failure.
1.7 Delete a family
Endpoint
DELETE https://www.tspoonlab.com/recipes/api/type/{idFamily}
Returns no body; HTTP error on failure.
1.8 Assign a family to products
Endpoint
POST https://www.tspoonlab.com/recipes/api/type/{idFamily}/components/add
Body
class NewTypeComponentWrapper { List<NewTypeComponent> components; } class NewTypeComponent { String id; // null when assigning String idComponent; // product ID }
Response
List<ComponentType> // assignments created (with new IDs)
1.9 Unassign a family from products
Endpoint
POST https://www.tspoonlab.com/recipes/api/type/{idFamily}/components/remove
Body
class NewTypeComponentWrapper { List<NewTypeComponent> components; } class NewTypeComponent { String id; // assignment ID to remove }
Returns no body.
Notes
Use the appropriate
type
value to keep domains separated (ingredients vs. recipes vs. dishes, etc.).Cost/Revenue and Nutritional property flags enable reporting and filtering use cases.
For large assignments, prefer the paged endpoint to list components.