zomato-api
v0.1.2
Published
A Node.js wrapper for Zomato API
Downloads
9
Readme
zomato-api
npm package for Zomato API
Installation
Install with npm:
npm install zomato-api
Usage
var zomato = require('zomato-api');
var client = zomato({
userKey: 'your api token'
})
Note: You should apply for an API token before you use this package.
Endpoints
Common
Categories
Use getCategories to return a list of categories.
client.getCategories()
.then(res => console.log(res))
.catch(err => console.log(err));
Cities
Use getCities to return details for a city. You can provide any of the following parameters:
- q: query by city name
- lat: latitude
- lon: longitude
- city_ids: comma separated city_id values
- count: number of max results to display
client.getCities({q: 'vancouver'})
.then(res => console.log(res))
.catch(err => console.log(err));
Collections
Use getCollections to return restaurant collections in a city. You can provide any of the following parameters:
- city_id: id of the city for which collections are needed
- lat: latitude of any point within a city
- lon: longitude of any point within a city
- count: max number of results needed
client.getCollections({city_id: 256})
.then(res => console.log(res))
.catch(err => console.log(err));
Cuisines
Use getCuisines to return a list of cuisines in a city. You can provide any of the following parameters:
- city_id: d of the city for which cuisines are needed
- lat: latitude of any point within a city
- lon: longitude of any point within a city
client.getCuisines({city_id: 256})
.then(res => console.log(res))
.catch(err => console.log(err));
Establishments
Use getEstablishments to return a list of restaurant types in a city. You can provide any of the following parameters:
- city_id: id of the city
- lat: latitude of any point within a city
- lon: longitude of any point within a city
client.getEstablishments({city_id: 256})
.then(res => console.log(res))
.catch(err => console.log(err));
Geocode
Use getGeocode to return a list of popular cuisines and nearby restaurants around the given coordinates. You can provide any of the following parameters:
- lat: latitude
- lon: longitude
client.getGeocode({lat: 49.267941, lon: -123.247360})
.then(res => console.log(res))
.catch(err => console.log(err));
Location
Location Details
Use getLocationDetails to return top cuisines, best rated restaurants, etc. in a given location. You can provide any of the following parameters:
- entity_id: location id obtained from locations api
- entity_type: location type obtained from locations api
client.getLocationDetails({entity_id: 36932, entity_type: 'group'})
.then(res => console.log(res))
.catch(err => console.log(err));
Locations
Use getLocations to return Zomato locations by keyword. You can provide any of the following parameters:
- query: suggestion for location name
- lat: latitude
- lon: longitude
- count: max number of results to fetch
client.getLocations({query: 'sashimi'})
.then(res => console.log(res))
.catch(err => console.log(err));
Restaurant
Daily Menu
Use getDailyMenu to return daily menu using Zomato restaurant ID. You can provide any of the following parameters:
- res_id: id of restaurant whose details are requested
client.getDailyMenu({res_id: 9186})
.then(res => console.log(res))
.catch(err => console.log(err));
Restaurant
Use getRestaurant to return detailed restaurant info using Zomato restaurant ID. You can provide any of the following parameters:
- res_id: id of restaurant whose details are requested
client.getRestaurant({res_id: 9186})
.then(res => console.log(res))
.catch(err => console.log(err));
Reviews
Use getReview to return reviews using Zomato restaurant ID. You can provide any of the following parameters:
- res_id: id of restaurant whose details are requested
- start: fetch results after this offset
- count: max number of results to retrieve
client.getReviews({res_id: 9186, start: 1})
.then(res => console.log(res))
.catch(err => console.log(err));
Search
Use search to return info based on the following parameters:
- entity_id: location id
- entity_type: location type
- q: search keyword
- start: fetch results after offset
- count: max number of results to display
- lat: latitude
- lon: longitude
- radius: radius around (lat,lon); to define search area, defined in meters(M)
- cuisines: list of cuisine id's separated by comma
- establishment_type: estblishment id obtained from establishments call
- collection_id: collection id obtained from collections call
- category: category ids obtained from categories call
- sort: sort restaurants by ...
- order: used with 'sort' parameter to define ascending / descending