This guide will be removed on April 29, 2022. Please use our new, easier-to-use Toast technical documentation site. All updated content is on the new site.

Constructing the menu

A restaurant's complete menu can be reconstructed via API calls.

In the above example, calling

GET /menus/a2a0b78a-a480-4adb-bbac-b32a7e0c2a12

returns

{
  "entityType":"Menu",
  "name":"Lunch Menu",
  "guid":"a2a0b78a-a480-4adb-bbac-b32a7e0c2a12",
  "groups":[
    {
      "guid":"578c5e48-7d99-438f-be61-f4f972569ce6",
      "entityType": "MenuGroup"
    }
  ]
}

Which gives you a list of MenuGroup GUIDs. For each one, you can the call

GET /menuGroups/578c5e48-7d99-438f-be61-f4f972569ce6

which returns

{
  "entityType":"MenuGroup",
  "name":"A Twist On Fries",
  "guid":"578c5e48-7d99-438f-be61-f4f972569ce6",
  "subgroups":[],
  "optionGroups": [
    {
      "entityType":"MenuOptionGroup",
      "guid":"f63f8bd3-9764-4b1b-b3c9-40c8c104b42b"
    }
  "items":[
    {
      "entityType":"MenuItem",
      "guid":"f21f2250-6f97-4a31-8a78-3283a5be0af4"
    }
  ]
}

giving you lists of the MenuItem GUIDs, MenuOptionGroup GUIDs, and MenuGroup GUIDs (none in this case) in each of those MenuGroups. For each such GUID, make the appropriate call:

GET /menuOptionGroups/f63f8bd3-9764-4b1b-b3c9-40c8c104b42b

{
  "entityType":"MenuOptionGroup",
  "name":"Size",
  "guid":"f63f8bd3-9764-4b1b-b3c9-40c8c104b42b",
  "items":[
    {
      "entityType":"MenuItem",
      "guid":"3c043245-3b4f-4e87-a6c9-6eeeb073518a"
    },
    {
      "entityType":"MenuItem",
      "guid":"68343381-290b-4410-9b8a-c8d63d9c9e1a"
    }
  ]
}

In this case we can see that there are two options in the "Size" MenuOptionGroup. These options themselves can of course be retrieved as above with GET /menuItems/<guid>.

Going back up to the "A Twist On Fries" group, make the calls for the listed MenuItems:

GET /menuItems/f21f2250-6f97-4a31-8a78-3283a5be0af4

This returns

{
  "entityType":"MenuItem",
  "name":"'Award Winning' Curly-Q Fries",
  "guid":"f21f2250-6f97-4a31-8a78-3283a5be0af4",
  "modifierGroups":[],
  "inheritOptionGroups":true
}

We've now retrieved all the relevant information, but there is one more step. Checking the inheritOptionGroups flag on each MenuItem, we can see that "'Award Winning' Curly-Q Fries" inherits MenuOptionGroups from its parent, "A Twist On Fries". This means that the "Size" options apply to it. To derive a resolved Menu structure from this information, remove the "optionGroups" attribute from "A Twist On Fries" and copy it into each MenuItem that inherits it (in this case just "'Award Winning' Curly-Q Fries"). Then remove the iniheritGroups flag from all menuItems. The final resolved Menu structure is

[
  {
    "entityType":"Menu",
    "name":"Lunch Menu",
    "guid":"a2a0b78a-a480-4adb-bbac-b32a7e0c2a12",
    "groups":[
      {
        "entityType":"MenuGroup",
        "name":"A Twist On Fries",
        "guid":"578c5e48-7d99-438f-be61-f4f972569ce6",
        "subgroups":[],
        "items":[
          {
            "entityType":"MenuItem",
            "name":"'Award Winning' Curly-Q Fries",
            "guid":"f21f2250-6f97-4a31-8a78-3283a5be0af4",
            "optionGroups": [
              {
                "entityType":"MenuOptionGroup",
                "name":"Size",
                "guid":"f63f8bd3-9764-4b1b-b3c9-40c8c104b42b",
                "items":[
                  {
                    "entityType":"MenuItem",
                    "name":"Half Basket",
                    "guid":"3c043245-3b4f-4e87-a6c9-6eeeb073518a",
                    "optionGroups":[]
                  },
                  {
                    "entityType":"MenuItem",
                    "name":"Full Basket",
                    "guid":"68343381-290b-4410-9b8a-c8d63d9c9e1a",
                    "optionGroups":[]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
]