Skip to main content

REST API: Waste (Mermas)

How to list and retrieve daily waste records

Gustavo Vera avatar
Written by Gustavo Vera
Updated today

1. How waste works

Users can register waste generated in their restaurant—for raw products (vegetables, meats, fish) and for intermediate or final preparations.
Each day’s waste is recorded and valued using the product cost or the recipe’s cost.


1.1 REST API: Login

Authenticate first; the login call returns a token to include in all requests.

Example (cURL)

[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

Use the token in subsequent requests:

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

1.2 Select a cost center / restaurant

All calls below refer to a cost center (usually a restaurant).
To fetch cost centers and IDs, see:
REST API: Get a list of cost centers

Add the cost center ID (idOrderCenter in UserOrderCenter) to your headers:

echo -n 'order:351583444167656299610202XXXXXXXXXXXX' >> rememberme.txt

Headers example

rememberme:aGVucnkudXBzYWxsLmRAZXXXXXXXXXXXXXXXXXX order:351583444167656299610202XXXXXXXXXXXX

1.3 List daily waste

Endpoint

GET https://www.tspoonlab.com/recipes/api/listThrownPaged?filter=&rows=50&start=0

Params

  • filter (string, optional) – text filter by description

  • rows, start (int, required) – pagination

Response

class ThrownEntry  {   private String id;   private String descr;   private String codi;   private String date; // display-formatted date }

Returns the daily waste groups (id, name/description, code, and date).


1.4 Get a specific daily waste record

Endpoint

GET https://www.tspoonlab.com/recipes/api/thrown/{id}

id is the identifier of the daily waste group.

Response

public class ThrownData  {   private String id;   private String descr;   private String codi;   private String dateFormatted;   private String comment;   private Date dateGenerated;   private String currency;   private Double cost;   private List<ThrownComponentData> listThrownComponents; }  class ThrownComponentData {   String id;   String descr;   String idComponent;   String idThrown;   short type;   Long color;    Double quantity;   String unit;   String idUnit;   Double cost;      // unit cost   String currency;    String idUse;   String use;    String idThrownType;   String thrownType;   String thrownTypeCodi; }

Notes

  • ThrownData.cost = total cost of waste for that day.

  • listThrownComponents contains each waste line.

  • For each ThrownComponentData:

    • type: item type (product, material, intermediate, final).

    • quantity with unit/idUnit: quantity and unit wasted.

    • Line cost = cost (unit cost) × quantity.

    • idUse / use: identifies the cut/use when waste is not the raw item (e.g., “julienne onion”).

    • idThrownType / thrownType / thrownTypeCodi: waste category (type and code).

    • color: for products, the color of the main family.


1.5 List waste types

Endpoint

GET https://www.tspoonlab.com/recipes/api/listThrownTypesPaged?filter=&rows=50&start=0

Params

  • filter (string, optional) – text filter

  • rows, start (int, required) – pagination

Response

class ThrownTypeEntry  {   private String id;   private String descr;   private String codi; }

Returns waste type ID, name, and code.


Notes

  • All endpoints require the rememberme token and the order (cost center) header.

  • Use HTTPS for all requests.

  • Default pagination example shown: rows=50, start=0.

Did this answer your question?