Dining API Version 2.0

How to use the Dining API

Using the API is very simple. There are two basic methods, getMenu and getHours. You can get data returned as either XML or JSON, the choice is yours. XML is returned by default. To return JSON, specify the json as the 'format' parameter to the end of your request (http://webapps.ncsu.edu/dining?method=getMenu&location=fountain&format=json

Hours and menus are only available one day into the future. That is, you can get tomorrow's menu, but not the day after tomorrow. Historical menus and hours are kept, but there is no guarantee they will be kept around for a long time, so don't depend on past items to be there.

Versions

If you'd like to get expanded information and a more useful feed, add v=2 to your request in order to use Version 2.0 of the API. By default it will use the older version of the API and return the data in the way it currently does.

Methods and Parameters

getMenu

getMenu requires a location key (case, clark, fountain) and that's it. You can optionally specify a date (in the format (YYYY-M-D) if you want, but it will return today's date by default. You can also pass the date as either 'today' or 'tomorrow.' You can specify a specific meal to return as well. The options for the "meal" parameter must be one of 'breakfast', 'lunch', 'brunch', 'dinner', or 'all'. It will default to 'all' if no specific meal is given. Lastly, you may specify a specific diet on which to filter. The diet parameter must be one of 'iron', 'weightGain', 'loseBodyFat', 'calcium', 'vegetarian', 'inactiveDay'. This will only return items that match that dietary specification. You can also specify a allergen parameter that must be one of 'gluten', 'nut', 'dairy', 'egg', 'seafood', or 'unknown'. If one of these is set, then it will *exclude* those items with the specified allergen from the results.

Menus are only available for dining halls.

Example: http://webapps.ncsu.edu/dining?method=getMenu&location=clark&date=tomorrow will return the menu for Clark dining hall for tomorrow's date.

getHours

getHours is the exact same as getMenu in the way it operates. Just pass it a location key and that's it. You can optionally specify a date (in the format (YYYY-M-D) if you want, but it will return today's date by default. You can pass the date as either 'today' or 'tomorrow' as well. It will return the schedule for the location. Note: a location may have more than one set of hours for a single day.

Example: http://webapps.ncsu.edu/dining?method=getHours&location=tacobell&date=2010-2-2 will return the hours for Taco Bell for February 2, 2010.

getLocationTypes

getLocations will return a list of all the location types in the system.

Example: http://webapps.ncsu.edu/dining?method=getLocationTypes will return the list of location types.

getLocations

getLocations will return a list of all the locations in the system. If you specify a type it will only return locations of that type. The available types are: diningHall, cStore, portCityJava, cafe, and other.

Example: http://webapps.ncsu.edu/dining?method=getLocations&type=diningHall will return the list of available dining halls. You can then use this to programatically find the specified keys for each dining hall to obtain their menus.