1. Event Creation
This REST interface allows external systems to create events with their corresponding menus in tSpoonLab.
Each event must include a unique code and description, which will be used to update it in future calls.
Each event can contain one or more menu groups (e.g., Appetizers, Main Courses, Desserts), and each group contains dishes identified by their code and description.
If any of the dishes do not already exist in tSpoonLab, they will be automatically created in the system using the provided code and description.
1.1 REST API: Login
Before making API calls, you must authenticate.
The login call returns a token that must be included in 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
Then, include the token in all following calls:
curl -X PUT -v -H "$(cat rememberme.txt)" $url/integration/call
1.2 Create or Update Events
To create or update events, menus, and dishes, send the following REST request:
POST https://www.tspoonlab.com/recipes/api/integration/event
Request Body
The request must include an Event
object:
public class Event { private String code; // Event code (required) private String descr; // Event description (required) private Integer pax; // Number of guests private Date date; // Event date private String codeClient; // Client code private String descrClient; // Client description private Short version; // Menu version (for updates) private short state; // Event state /* public static final short offer = 0; public static final short approved = 1; public static final short cancelled = 2; public static final short done = 3; public static final short opportunity = 4; public static final short rejected = 5; */ private List<EventMenuGroup> listGroups; // List of menu groups }
Event Structure
An event consists of one or more menu groups, typically representing phases such as Appetizers, Mains, and Desserts.
public class EventMenuGroup { private String descr; // Menu group name (e.g., Appetizers, Mains, Desserts) private List<EventMenuGroupComponent> listComponents; }
Each group contains dishes with their respective details:
public class EventMenuGroupComponent { private String codi; // Dish code private String descr; // Dish name private Double quantity; // Quantity (number of portions) }
Notes
The event code is unique and must remain consistent for updates.
If a dish code does not exist, tSpoonLab will automatically create a new dish record.
Each event can contain multiple groups and dishes, allowing flexible menu structures for catering or special events.