-
Notifications
You must be signed in to change notification settings - Fork 0
APIs
lolagarden edited this page May 23, 2020
·
5 revisions
- The primary API used to support Dinr is the Zomato API which gives access to restaurant information.
- API calls are made to /geocode which gets a number of restaurants for a given location.
- This request provides information about a restaurant including it's name, location, price level, reviews, and photos.
Method: GET
Description: This method is used to get a number of restaurants from Zomato based on the users current location
| Parameters | Format | Parameter Type |
|---|---|---|
| userKey | String | Header |
| lat | Double | Query |
| lon | Double | Query |
example request URL: https://developers.zomato.com/api/v2.1/geocode?lat=35&lon=175
STATUS CODE: 200
Response Class (Status 200)
Model Schema
{
"locality": {
"entity_type": "group",
"entity_id": "36932",
"title": "Chelsea Market, Chelsea, New York City",
"latitude": "40.742051",
"longitude": "-74.004821",
"city_id": "280",
"city_name": "New York City",
"country_id": "216",
"country_name": "United States"
},
"popularity": {
"popularity": "4.92",
"nightlife_index": "4.95",
"top_cuisines": [
"cafe"
]
},
"link": "https://www.zomato.com/new-york-city/chelsea-restaurants",
"nearby_restaurants": [
{
"id": "16774318",
"name": "Otto Enoteca & Pizzeria",
"url": "https://www.zomato.com/new-york-city/otto-enoteca-pizzeria-greenwich-village",
"location": {
"address": "1 5th Avenue, New York, NY 10003",
"locality": "Greenwich Village",
"city": "New York City",
"latitude": "40.732013",
"longitude": "-73.996155",
"zipcode": "10003",
"country_id": "216"
},
"average_cost_for_two": "60",
"price_range": "2",
"currency": "$",
"thumb": "https://b.zmtcdn.com/data/pictures/chains/8/16774318/a54deb9e4dbb79dd7c8091b30c642077_featured_thumb.png",
"featured_image": "https://d.zmtcdn.com/data/pictures/chains/8/16774318/a54deb9e4dbb79dd7c8091b30c642077_featured_v2.png",
"photos_url": "https://www.zomato.com/new-york-city/otto-enoteca-pizzeria-greenwich-village/photos#tabtop",
"menu_url": "https://www.zomato.com/new-york-city/otto-enoteca-pizzeria-greenwich-village/menu#tabtop",
"events_url": "https://www.zomato.com/new-york-city/otto-enoteca-pizzeria-greenwich-village/events#tabtop",
"user_rating": {
"aggregate_rating": "3.7",
"rating_text": "Very Good",
"rating_color": "5BA829",
"votes": "1046"
},
"has_online_delivery": "0",
"is_delivering_now": "0",
"has_table_booking": "0",
"deeplink": "zomato://r/16774318",
"cuisines": "Cafe",
"all_reviews_count": "15",
"photo_count": "18",
"phone_numbers": "(212) 228-2930",
"photos": [
{
"id": "u_MjA5MjY1OTk5OT",
"url": "https://b.zmtcdn.com/data/reviews_photos/c15/9eb13ceaf6e90129c276ce6ff980bc15_1435111695_640_640_thumb.JPG",
"thumb_url": "https://b.zmtcdn.com/data/reviews_photos/c15/9eb13ceaf6e90129c276ce6ff980bc15_1435111695_200_thumb.JPG",
"user": {
"name": "John Doe",
"zomato_handle": "John",
"foodie_level": "Super Foodie",
"foodie_level_num": "9",
"foodie_color": "f58552",
"profile_url": "https://www.zomato.com/john",
"profile_deeplink": "zoma.to/u/1170245",
"profile_image": "string"
},
"res_id": "16782899",
"caption": "#awesome",
"timestamp": "1435111770",
"friendly_time": "3 months ago",
"width": "640",
"height": "640",
"comments_count": "0",
"likes_count": "0"
}
],
"all_reviews": [
{
"rating": "5",
"review_text": "The best latte I've ever had. It tasted a little sweet",
"id": "24127336",
"rating_color": "305D02",
"review_time_friendly": "2 months ago",
"rating_text": "Insane!",
"timestamp": "1435507367",
"likes": "0",
"user": {
"name": "John Doe",
"zomato_handle": "John",
"foodie_level": "Super Foodie",
"foodie_level_num": "9",
"foodie_color": "f58552",
"profile_url": "https://www.zomato.com/john",
"profile_deeplink": "zoma.to/u/1170245",
"profile_image": "string"
},
"comments_count": "0"
}
]
}
]
}
- The Bing Maps API is another API which is utilised in this project in order to calculate distance.
- The Distance Matrix request is used to calculate the driving distance between the host user's current location and the restaurants specified.
Method: GET
Description: This method is used to get the distance between two positions.
| Parameters | Format | Parameter Type |
|---|---|---|
| origin | Double | Query |
| destination | Double | Query |
| travelMode | String | Query |
| key | String | Query |
| distanceUnit | String | Query |
| timeUnit | String | Query |
STATUS CODE: 200
Response Class (Status 200)
Model Schema
{
"authenticationResultCode":"ValidCredentials",
"brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
"copyright":"Copyright © 2020 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
"resourceSets":[
{
"estimatedTotal":1,
"resources":[
{
"__type":"DistanceMatrix:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
"destinations":[
{
"latitude":-36.9301,
"longitude":174.7674
}
],
"errorMessage":"Request completed.",
"origins":[
{
"latitude":-36.9201,
"longitude":174.7574
}
],
"results":[
{
"destinationIndex":0,
"originIndex":0,
"totalWalkDuration":0,
"travelDistance":1.172,
"travelDuration":3.417
}
]
}
]
}
],
"statusCode":200,
"statusDescription":"OK",
"traceId":"2a30cb5178224a178b4bc60da0620c42|HK00000BE0|0.0.0.0|HK00000A3C, HK00000882"
}