Skip to main content

REST API: Productions

Learn how to list batches, view productions, and create or update production records through the tSpoonLab REST API.

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

1. Overview

This guide explains how to:

  • List all batches (partidas).

  • List productions within each batch.

  • Create new productions.

  • Retrieve ingredient data for a specific production.

All requests require authentication using your login token and a valid cost center (restaurant) identifier.


2. Authentication (Login)

Before making any API calls, you must authenticate via the /login endpoint.

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 -H "content-type: application/x-www-form-urlencoded" --data $authenticate $url/login >> rememberme.txt

This request returns a token.
You must include it in all subsequent requests:

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

3. Selecting a Cost Center / Restaurant

Each request must include a cost center identifier (idOrderCenter), which usually corresponds to a restaurant.

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

Add to headers:

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

Example combined headers:

rememberme:aGVucnkudXBzYWxsLmRAZXXXXXXXXXXXXXXXXXX order:351583444167656299610202XXXXXXXXXXXX

4. List All Batches

Endpoint

GET /recipes/api/listPartidesPaged?filter=&rows=50&start=0

Parameters:

  • filter: text filter by description

  • start, rows: pagination

Returns

class EntityBaseDescr {    String id;    String descr; }

5. Retrieve Production ID for a Given Day

Endpoint

POST /recipes/api/production/day/{year}/{month}/{day}

If it’s the first request for that date, the ID will be created.
Subsequent requests for the same day return the same ID.

Response

class IdWrapper {   String id; }

6. List Productions for a Specific Day

Endpoint

GET /recipes/api/productionComponentList?id={productionId}&idPartida={batchId}
  • id: production ID (required)

  • idPartida: batch ID (optional)

Response

class ProductionDay {  String id;  String date;  int year;  int month;  int day;  List<ProductionDayComponent> listComponents; }

Each component represents a production:

class ProductionDayComponent {  String id;  String idComponent;  String descr;  String comment;  String dateGeneratedFlat;  String lot;  ProductionComponentStatus status;  String idPartida;  String partida;  List<ComponentServiceProduction> listComponentService; }

Production status:

ProductionComponentStatus {  boolean started;  boolean done; }
  • Pending → started=false, done=false

  • In progress → started=true, done=false

  • Finished → started=true, done=true


7. Start, Finish, or Restart a Production

Action

Method

Endpoint

Start

PUT

/productionComponent/{id}/start/status

Finish

PUT

/productionComponent/{id}/done

Restart

PUT

/productionComponent/{id}/redo

Each call returns an updated ProductionComponentStatus.


8. Create a New Production

1️⃣ Select an elaboration

GET /recipes/api/listComponentsPartidaPagedEx?filter=&filterType=recipeAndDish&partida={idPartida}&start=0;rows=50

2️⃣ Get default quantities

GET /recipes/api/component/{idComponent}/quantityUnit

3️⃣ Create the production

POST /recipes/api/production/{idProduction}/component/{idComponent}/quantities/events

Body (application/json):

class NewProductionComponentWithEvents {    List<NewProductionComponentEventQuantity> quantities; }  class NewProductionComponentEventQuantity {   String idUnit;   Double quantity; }

Response

class IdWrapper {   String id; }

9. Delete a Production

DELETE /recipes/api/productionComponent/{idProductionComponent}

10. Create, Start, and Finish in One Step

POST /recipes/api/production/component

Body

class NewCreateProduction {     String idComponent;     double quantity;      Date date; }

Response

class IdWrapper {   String id; }

Notes

  • All endpoints require a valid rememberme token and cost center header.

  • Use HTTPS for all requests.

  • Pagination defaults: rows=50, start=0.

Did this answer your question?