npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zomato

v1.1.0

Published

node.js wrapper for Zomato API

Downloads

36

Readme

zomato

NPM

npm package for Zomato API

Installation

Install using npm:

npm install zomato

Usage

Require library

var zomato = require('zomato');

Create client

var client = zomato.createClient({
  userKey: 'API Token', //as obtained from [Zomato API](https://developers.zomato.com/apis)
});

Get a list of categories. List of all restaurants categorized under a particular restaurant type can be obtained using /Search API with Category ID as inputs.

client.getCategories(null, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

##Find the Zomato ID and other details for a city . You can obtain the Zomato City ID in one of the following ways -

  • City Name in the Search Query - Returns list of cities matching the query
  • Using coordinates - Identifies the city details based on the coordinates of any location inside a city

If you already know the Zomato City ID, this API can be used to get other details of the city

client.getCities({
q:"New Delhi", //query by city name
lat:"28.613939", //latitude
lon:"77.209021", //longitude
city_ids:"1,2,3", //comma separated city_ids value
count:"2" // number of maximum result to display
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

##Returns Zomato Restaurant Collections in a City. The location/City input can be provided in the following ways -

  • Using Zomato City ID
  • Using coordinates of any location within a city

List of all restaurants listed in any particular Zomato Collection can be obtained using the '/search' API with Collection ID and Zomato City ID as the input.

client.getCollections({
city_id:"1", //id of the city for which collections are needed
lat:"28.613939", //latitude
lon:"77.209021", //longitude
count:"2" // number of maximum result to display
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

##Get a list of all cuisines of restaurants listed in a city. The location/city input can be provided in the following ways - -Using Zomato City ID -Using coordinates of any location within a city ##List of all restaurants serving a particular cuisine can be obtained using '/search' API with cuisine ID and location details

client.getCuisines({
city_id:"1", //id of the city for which collections are needed
lat:"28.613939", //latitude
lon:"77.209021" //longitude
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

##Get a list of restaurant types in a city. The location/City input can be provided in the following ways - -Using Zomato City ID -Using coordinates of any location within a city ##List of all restaurants categorized under a particular restaurant type can obtained using /Search API with Establishment ID and location details as inputs

client.getEstablishments({
city_id:"1", //id of the city for which collections are needed
lat:"28.613939", //latitude
lon:"77.209021" //longitude
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

##Get Foodie and Nightlife Index, list of popular cuisines and nearby restaurants around the given coordinates

client.getGeocode({
lat:"28.613939", //latitude
lon:"77.209021" //longitude
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

##Get Foodie Index, Nightlife Index, Top Cuisines and Best rated restaurants in a given location

client.getLocationDetails({
entity_id:"36932", //location id obtained from locations api
entity_type:"group" //location type obtained from locations api
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

Search for Zomato locations by keyword. Provide coordinates to get better search results

client.getLocations({
query:"New Delhi", // suggestion for location name
lat:"28.613939", //latitude
lon:"77.209021", //longitude
count:"2" // number of maximum result to fetch
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

Search for Zomato locations by keyword. Provide coordinates to get better search results

client.getDailyMenu({
res_id:"9186" // id of restaurant whose details are requested
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

Get detailed restaurant information using Zomato restaurant ID. Partner Access is required to access photos and reviews.

client.getRestaurant({
res_id:"9186" // id of restaurant whose details are requested
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

Get restaurant reviews using the Zomato restaurant ID

client.getReviews({
res_id:"9186" , // id of restaurant whose details are requested
start : "0" , //fetch results after this offset (Integer)
count: "5" , max number of results to retrieve

}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

The location input can be specified using Zomato location ID or coordinates. Cuisine / Establishment / Collection IDs can be obtained from respective api calls. Partner Access is required to access photos and reviews.

##Examples -

  • To search for 'Italian' restaurants in 'Manhattan, New York City', set cuisines = 55, entity_id = 94741 and entity_type = zone
  • To search for 'cafes' in 'Manhattan, New York City', set establishment_type = 1, entity_type = zone and entity_id = 94741
  • Get list of all restaurants in 'Trending this Week' collection in 'New York City' by using entity_id = 280, entity_type = city and collection_id = 1
client.search({
entity_id:"36932",//location id
entity_type:"group", // location type (city,subzone,zone , landmark, metro,group)
q:"Cafe" ,//Search Keyword
lat:"28.613939", //latitude
lon:"77.209021", //longitude
count:"2", // number of maximum result to display
start:"1" , //fetch results after offset
radius:"10000" , //radius around (lat,lon); to define search area, defined in meters(M)
cuisines : "3,7" , //list of cuisine id's separated by comma
establishment_type : "" , //estblishment id obtained from establishments call
collection_id : "29" , //collection id obtained from collections call
category :  "9" ,//	category ids obtained from categories call
sort : " cost,rating,real_distance" ,//choose any one out of these available choices
order: "asc" //	used with 'sort' parameter to define ascending(asc )/ descending(desc)

}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});