Skip to main content

REST API: Menus

How to list, retrieve, and create menus

Gustavo Vera avatar
Written by Gustavo Vera
Updated today

1. Menu Management

This document explains how to manage menus, which group dishes into sections (starters, mains, desserts, etc.) and define how many dishes the customer can choose from each section.


1.1 REST API: Login

To make API calls, first you must authenticate using the login endpoint.
The login returns a token that must be included in all subsequent 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 all later requests:

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

1.2 Select a Cost Center / Restaurant

The following requests refer to a cost center (usually a restaurant).

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

Add the idOrderCenter value to your headers:

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

Headers example

rememberme:aGVucnkudXBzYWxsLmRAZXXXXXXXXXXXXXXXXXX order:351583444167656299610202XXXXXXXXXXXX

1.3 Select a Dish Book (Final Recipe Book)

Menus can belong to specific dish books.
To get the list of books and their IDs, see:
REST API: Retrieve a list of Dish Books

Each book corresponds to the field idRecipeCenter in UserRecipeCenter.

Add the book ID to your headers:

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

So, your headers should include:

rememberme:aGVucnkudXBzYWxsLmRAZXXXXXXXXXXXXXXXXXX recipe:351583444167656299610202XXXXXXXXXXXX order:351583444167656299610202XXXXXXXXXXXX

To perform operations across all dish books, set:

recipe:all

1.4 Retrieve all Menus

Endpoint

GET https://www.tspoonlab.com/recipes/api/listMenusPagedEx

Query params

  • start (int, required) – first row index

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

  • filter (string, optional) – filter by name or description

Response

class EntityBaseMenu {   String id;   String descr;   String codi;   String altDescr;   String date;   Date dateGenerated;   boolean template;   Double pax; }

Field descriptions

  • id: menu ID

  • descr: menu name

  • codi: menu code

  • altDescr: alternative name

  • date, dateGenerated: creation dates (text/Date format)

  • template: true if it’s a menu template

  • pax: number of diners for which the menu is defined


1.5 Retrieve a specific Menu

Endpoint

GET https://www.tspoonlab.com/recipes/api/menu/ext/{idMenu}

idMenu is the menu identifier returned by the previous call.

Response

class MenuExt {  String id;  String descr;  String altDescr;  String codi;  boolean template;  Date date;  String dateFormatted;  Double pax;   Double costMin;  Double costMax;  Double costAvg;  List<MenuGroupExt> listMenuGroup; }

Notes

  • costMin, costMax, costAvg: minimum, maximum, and average cost of the menu

  • listMenuGroup: sections within the menu

MenuGroupExt

class MenuGroupExt {   String id;   String descr;   String comment;   Double costMin;   Double costMax;   Double costAvg;   List<MenuGroupComponentExt> listMenuGroupComponent;   int typeMenuGroup;   Short numSelected; }

Each section contains one or more dishes and defines how they are chosen.

typeMenuGroup possible values:

short allIncluded = 0; short chooseOne = 1; short chooseMoreThanOne = 2; short chooseMoreThanOneRepeated = 3;
  • allIncluded → all dishes are served

  • chooseOne → user selects one dish

  • chooseMoreThanOne → user selects multiple different dishes

  • chooseMoreThanOneRepeated → user can select multiple dishes, including repeats

numSelected: number of dishes to be chosen (only applies to the last two types).

MenuGroupComponentExt

class MenuGroupComponentExt {  String id;  String idComponent;  String descrComponent;   String idUnit;  String descrUnit;   String comment;  Double quantity;  Double cost; }

Each record represents a dish within the section:

  • idComponent / descrComponent: dish ID and description

  • idUnit / descrUnit: unit of measure

  • quantity: quantity per menu (for defined pax)

  • cost: dish cost


1.6 Create a new Menu

Endpoint

POST https://www.tspoonlab.com/recipes/api/menu/no/groups

Body

class NewMenu {  String descr;  String altDescr;  String comment;  String codi;  Date date;  Boolean template;  Double pax; }

Field descriptions

  • descr: menu name

  • altDescr: alternative name

  • comment: notes or comments

  • codi: code

  • date: menu date (optional)

  • template: true if it’s a template

  • pax: number of diners

Response

class IdWrapper { String id; } // returns new menu ID

1.7 Add dishes to a Menu

Endpoint

PUT https://www.tspoonlab.com/recipes/api/menu/{idMenu}/components

Body

class NewMenuGroupWrapper {   List<NewMenuGroup> menuGroups; }  class NewMenuGroup {  String descr;  String comment;  short typeMenuGroup;  Short numSelected;  int position;  List<NewMenuGroupComponent> listMenuGroupComponent; }  class NewMenuGroupComponent {  String idComponent;  String idUnit;  Double quantity;  String comment;  int position; }

Notes

  • typeMenuGroup: defines dish selection behavior (see section 1.5).

  • numSelected: only applies when the section allows choosing multiple dishes.

  • position: defines section order in the menu.

  • listMenuGroupComponent: dishes in that section.


1.8 Delete a Menu

Endpoint

DELETE https://www.tspoonlab.com/recipes/api/menu/{idMenu}

Deletes the specified menu by ID.


Notes

  • All endpoints require valid headers:

    • rememberme → authentication token

    • order → cost center

    • recipe → dish book (or all)

  • Use HTTPS for all requests.

  • Menu templates are useful for recurring menu structures.

Did this answer your question?