Skip to content

Restaurants and menus

A restaurant is a Place of a FoodEstablishment kind (Restaurant, CafeOrCoffeeShop, BarOrPub, Bakery, FastFoodRestaurant...). What it serves is a Menu, in MenuSections, of MenuItems, each priced by an Offer.

A menu

curl -X POST https://apis.objectsgrid.com/menus -H 'X-ObjectsGrid-AccessPoint: EU' -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' -d '{"name": [{"at_language": "en", "at_value": "Dinner"}], "inLanguage": "en",
  "openingHoursSpecification": [{"dayOfWeek": ["https://schema.org/Friday", "https://schema.org/Saturday"], "opens": "18:00:00", "closes": "23:00:00"}]}'

The restaurant lists its menus in hasMenu:

{"name": [{"at_language": "en", "at_value": "Bistro du Parc"}], "additionalType": "Restaurant",
 "hasMenu": [{"at_id": "https://apis.objectsgrid.com/menus/<dinner>"}]}

Sections and dishes

A section points to its menu (partOfMenu), a dish to its section (partOfMenuSection), and position orders them. Adding a dish is one write, and two people editing two sections never conflict:

{"name": [{"at_language": "en", "at_value": "Onion soup"}, {"at_language": "fr", "at_value": "Soupe à l'oignon"}],
 "partOfMenuSection": {"at_id": "https://apis.objectsgrid.com/menusections/<starters>"}, "position": 1,
 "suitableForDiet": ["https://schema.org/VegetarianDiet"], "allergens": ["Gluten", "Milk", "Celery"],
 "nutrition": {"calories": "420 kcal", "servingSize": "300 g"}}
  • Diets are Schema.org's RestrictedDiet values: VeganDiet, VegetarianDiet, GlutenFreeDiet, HalalDiet, KosherDiet, LowLactoseDiet and the others.
  • Allergens are the 14 the EU requires a menu to show: Gluten, Crustaceans, Eggs, Fish, Peanuts, Soybeans, Milk, Nuts, Celery, Mustard, SesameSeeds, SulphurDioxideAndSulphites, Lupin, Molluscs.
  • A list finds dishes without an allergen: GET /menuitems?where={"NOT": [{"allergens": {"has": "Peanuts"}}]}.

Reading a whole menu

GraphQL reads a menu with its sections and dishes in one request:

query {
  menu(id: "<dinner>") {
    name { at_value }
    hasMenuSection(orderBy: [{position: asc}]) {
      items { name { at_value } hasMenuItem { items { name { at_value } allergens offers { items { price priceCurrency } } } } }
    }
  }
}

Prices and orders

A dish's price is an Offer whose itemOffered is the dish: its availability marks it sold out, and its priceSpecification handles member prices as for any Offer. Takeaway and delivery orders use Carts of those Offers, checked out into Orders.

For Google

A Menu's JSON-LD document embeds its sections and dishes as Schema.org describes them. Some fields are ObjectsGrid's, beyond Schema.org: allergens, spiciness, a menu's hours and the links back from a dish or section (partOfMenu, partOfMenuSection). They are left out of JSON-LD documents.