1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- Juvenes offers a webservice that provides a JSON format information for their restaurants. The Data is somewhat complexed at the first glimpse, but I will break it down in this file for you.
- You can fetch data for one restaurant for each restaurant by weekdays with the following url:
- "http://www.juvenes.fi/DesktopModules/Talents.LunchMenu/LunchMenuServices.asmx/GetMenuByWeekday?KitchenId=(KITCHEN)&MenuTypeId=(MENUTYPE)&Week=(WEEK)&Weekday=(WEEKDAY)&lang=(LANGUAGE)&format=json"
- Where:
- (KITCHEN) is replaced with Kitchen Id for the wanted restaurant
- (MENUTYPE) is replaced with Menutype Id which depends on the restaurant and menu line for example Newton restaurant has both Fusion Kitchen and Regular kitchen.
- (WEEK) is replaced with the wanted week 1-52, you can only search for few weeks in advance though
- (WEEKDAY) is replaced with with wanted day of the week 1-7, 1 being Monday and so on.
- (LANGUAGE) can either be 'fi' or 'en'.
- Kitchens:
- Tampere University of Technology:
- Edison: (KITCHEN) = 2, (MENUTYPE) = 60
- Newton: (KITCHEN) = 6, (MENUTYPE) = 60
- Zip: (KITCHEN) = 12, (MENUTYPE) = 60
- Fusion: (KITCHEN) = 6, (MENUTYPE) = 3
- Pasta: (KITCHEN) = 26, (MENUTYPE) = 11
- Voltti: (KITCHEN) = 25, (MENUTYPE) = 4
- Tampere University
- MainCampus: (KITCHEN) = 13, (MENUTYPE) = 60
- Fusion: (KITCHEN) = 13, (MENUTYPE) = 3
- SaladBar: (KITCHEN) = 13, (MENUTYPE) = 5
- MedicaBio: (KITCHEN) = 5, (MENUTYPE) = 60
- MedicaArvo: (KITCHEN) = 27, (MENUTYPE) = 60
- ArvoFusion: (KITCHEN) = 27, (MENUTYPE) = 3
- For example if you wanted to get the week 50 monday menu for Tampre University of Technology Newton in finnish you would call for:
- "http://www.juvenes.fi/DesktopModules/Talents.LunchMenu/LunchMenuServices.asmx/GetMenuByWeekday?KitchenId=6&MenuTypeId=60&Week=50&Weekday=1&lang='fi'&format=json"
- The JSON data format:
- Juvenes JSON data consists of these items and their attributes
- d:
- {
- Name: Some of the restaurants dont use this so dont count on this exsisting when printing out restaurant name.
- AdditionalName: String for additional name.
- MenuTypeName: What sort of menu is it for example "Lounas" which means lunch.
- MenuId: int for the menu, not the same as MENUTYPE.
- MenuTypeId: same as MENUTYPE.
- MenuDate: Date format object.
- Week: Week of the year.
- Weekday: Day of the week.
- MealOptions: [] Array for different meals
- ]
- }
- MealOptions:
- {
- MealOptionId: Id for the food.
- MenuDate: Serving date, DD.MM.YYYY format string.
- ExternalGroupId: Tbh dont really know what this stands for seems to be the same for all options.
- Name: Header for the dish, not the actual name of the food.
- MenuItems: [] Array for the main ingredients of the dish.
- ForceMajeure: String reserved for ForceMajeure situation.
- AlsoAvailable: If something else is available
- ExtraItems: ExtraItems for the dish.
- }
- MenuItems:
- {
- Name: Name of the main ingredient. For example Chicken breast, or peasoup.
- Ingredients: Breakdown of the ingredients in the main ingredient, stuff like salt, pepper, onions etc.
- Diets: Tells if the dish doesnt have egg, laktose, etc.
- NutritiveValues: Breakdown of different nutrition values.
- }
- NutritiveValues:
- {
- Name: Name of the nutrition. Proteins, Energy, Fat etc.
- Units: [] Array for the values and the units for the nutrition
- DailyAmmount: How much is the suggested daily value
- }
- Units:
- {
- Unit: the units for nutrition values, g, kcal or kJ
- Value: ammount as float
- }
- The class structure to take this information is inside Juvenes.cs so you can just include it in your project change the namespace to the one you use and use JSON.net deserializer with menuRoot type object.
- Example:
- using Newtonsoft.Json;
- namespace YourAppNamespace
- ...
- // newtonJsonString is a string containing the JSON format string.
- public void YourDeserializeFunction(newtonJsonString)
- {
- menuRoot menu_newton = JsonConvert.Deserialize<menuRoot>(newtonJsonString);
- }
- ...
|