Menu Items

HTTP Location

{API BASE}/menuitems/{ID}
 

Example

http://api.opendining.net/menuitems/4b96f1bafc9f100ca79231ef
 

Properties

PROPERTY NAME TYPE REQUIRED DESCRIPTION
id String Yes The ID of the menu item. This is a MongoDB Object ID string.
name String Yes The name of the menu item.
restaurant String Yes The ID of the restaurant that features this menu item on its menu. This is a MongoDB Object ID string.
category String Yes The name of the menu category to which this menu item belongs, like “Sandwiches” or “Drinks.”
image_url String No The URL of an image associated with the menu item.
description String No A description to go with the menu item.
tags Array No An array of strings representing the menu item’s tags.
prices Array Yes An array of price objects.
option_groups Array No An array of option group objects representing the various options that this menu item features.
can_order Boolean No Returned from API queries. True if the item can currently be ordered; false otherwise. If this is false, you should hide any order buttons.
 

Prices

A menu item can have multiple prices. A good example of this is a soft drink: a restaurant may want to set different prices for a Small, Medium, and Large drink. The prices array contains a list of objects, each with a name and price property.
 

PROPERTY NAME TYPE DESCRIPTION
name String The name of the price. Example: Small.
price Decimal The value of the price. Example: 2.75.
 

Note: If an item only has one price, it is acceptable for the name property to contain just an empty string (“”). Please make sure this is accounted for in any applications. Ideally, an application would check the prices array to see if it only has one element, and if that element’s name is just an empty string, simply display the price without a name.
 

Show me an example!

OK, here’s what a prices array could look like, in JSON:

[
     { "name" : "Small", "price" : 2 }, 
     { "name" : "Medium", "price" : 3.50 }, 
     { "name" : "Large", "price" : 4 } 
]

Option Groups

We also want to make menu items customizable, so you can have it your way! This is done through option groups. An option group is a group of related options (very aptly named). For example, a sub sandwich may have any number of veggies that a customer could choose to add. In addition, an option group may allow multiple selections (like with veggies), or it may only allow exactly one selection (such as a drink type — you can’t pick both Coke and Diet Coke; that would be ambiguous).
 

Here is the full list of an option group’s properties:
 

PROPERTY NAME TYPE DESCRIPTION
name String The name of the option group. Example: Veggies.
multiselect Boolean Does the option group allow multiple selections? This is true if it does, and false if the maximum number of selections is 1.
min Integer How many options must be selected at minimum? If this is greater than 1, the option is required.
max Integer How many options can be selected, at most? This field is optional; if not present, assume that there is no maximum.
options Array An array of options.
 

Required Options

If the “required” field is set to true, then at least one option must be selected. A good example of a required option is a drink flavor. If the customer doesn’t tell me what kind of drink they want, I would not be able to complete the order.
 

Multi-select Options

If the “multiselect” field is set to true, then more than one option can be selected. If multiselect is false, then no more than one option can be selected. So if required is true and multiselect is false, then exactly one option must be selected. In the above sub sandwich example, the Veggies option group would probably allow multi-select, because I can opt for both lettuce and tomatoes.
 

Options Array

The options array contains a list of options within the group. The option objects are formatted exactly like the price objects described above, with two properties: name and price. Remember that not all options cost extra, so price can be zero. If price is empty or not set, the option is free.
 

Show me an example!

OK, here’s what an option group could look like, in JSON:

{

     "name" : "Veggies",

     "multiselect" : true,

     "required" : false,

     "options" : [

          { "name" : "Onions", "price" : 0 }

          { "name" : "Tomatoes", "price" : 0 }

          { "name" : "Olives", "price" : 0.5 }

     ]

}

HTTP Methods

Currently, we only support GET on the menu items collection (to support consumer-facing applications). PUT/POST/DELETE will be added in future API versions. If you need this support immediately, please contact us and we’ll get you set up.