SkillAgentSearch skills...

Zomato.js

zomato.js is a simple promise based JS wrapper for the Zomato API

Install / Use

/learn @jayeshsolanki93/Zomato.js
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

zomato.js NPM Version Build Status

zomato.js is a simple promise based JS wrapper for the Zomato API

Requirements

  • You will need node version 6 or greater
  • An api key from https://developers.zomato.com/api

Installation

npm install --save zomato.js

Usage

const Zomato = require('zomato.js');
const z = new Zomato('YOUR-API-KEY');

z
  .categories()
  .then()
  .catch()

API Reference

categories

Get lists of categories

Parameters

None

Returns

Promise

Example
zomato
  .categories()
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });
Sample Response
[ { id: 1, name: 'Delivery' },
  { id: 2, name: 'Dine-out' },
  { id: 3, name: 'Nightlife' },
  { id: 4, name: 'Catching-up' },
  { id: 5, name: 'Takeaway' },
  { id: 6, name: 'Cafes' },
  { id: 7, name: 'Daily Menus' },
  { id: 8, name: 'Breakfast' },
  { id: 9, name: 'Lunch' },
  { id: 10, name: 'Dinner' },
  { id: 11, name: 'Pubs & Bars' },
  { id: 12, name: 'Premium Delivery' },
  { id: 13, name: 'Pocket Friendly Delivery' },
  { id: 14, name: 'Clubs & Lounges' } ]

cities

Get city details

Parameters

| Name | Type | Description | | :-------: | :----: | :-------------------------------------: | | options | Object | options containing the params to send |

Options

| Name | Type | Description | Required | | :--------: | :----: | :----------------------------------: | :------: | | q | String | Query by city name | No | | lat | Number | Latitude | No | | lon | Number | Longitude | No | | city_ids | String | Comma separated city_id values | No | | count | Number | The number of max results to display | No |

Returns

Promise

Example
zomato
  .cities({
    q: 'New',
    count: 2
  })
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });
Sample Response
[ { id: 280,
    name: 'New York City, NY',
    country_id: 216,
    country_name: 'United States',
    discovery_enabled: 1,
    has_new_ad_format: 0,
    is_state: 0,
    state_id: 103,
    state_name: 'New York State',
    state_code: 'NY' },
  { id: 1,
    name: 'Delhi NCR',
    country_id: 1,
    country_name: 'India',
    discovery_enabled: 0,
    has_new_ad_format: 1,
    is_state: 0,
    state_id: 0,
    state_name: '',
    state_code: '' } ]

collections

Get zomato collections in a city

Parameters

| Name | Type | Description | | :-------: | :----: | :-------------------------------------: | | options | Object | options containing the params to send |

Options

| Name | Type | Description | Required | | :--------:| :----: | :----------------------------------: | :-------:| | city_id | Number | The id of the city | No | | lat | Number | Latitude | No | | lon | Number | Longitude | No | | count | Number | The number of max results to display | No |

Returns

Promise

Example
zomato
  .collections({
    lat: 19.0895595,
    lon: 72.8634203,
    count: 5
  })
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });
Sample Response
[ { collection_id: 1,
    res_count: 30,
    image_url: 'https://b.zmtcdn.com/data/collections/e140962ec7eecbb851155fe0bb0cd28c_1463395649.jpg',
    url: 'https://www.zomato.com/mumbai/top-restaurants?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1',
    title: 'Trending this Week',
    description: 'The most popular restaurants in town this week',
    share_url: 'http://www.zoma.to/c-3/1' },
  { collection_id: 29,
    res_count: 38,
    image_url: 'https://b.zmtcdn.com/data/collections/4661c54a624d8a055119af2d0ccde724_1463399059.jpg',
    url: 'https://www.zomato.com/mumbai/best-new-restaurants?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1',
    title: 'New Restaurants you Probably Haven't Tried Yet',
    description: 'The best new places in town',
    share_url: 'http://www.zoma.to/c-3/29' },
  { collection_id: 17,
    res_count: 24,
    image_url: 'https://b.zmtcdn.com/data/collections/b2a9346ab0f03785350b96d983841902_1463635759.jpg',
    url: 'https://www.zomato.com/mumbai/shisha?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1',
    title: 'Sheesha Lounges',
    description: 'Enjoy a great selection of sheesha',
    share_url: 'http://www.zoma.to/c-3/17' },
  { collection_id: 339,
    res_count: 30,
    image_url: 'https://b.zmtcdn.com/data/collections/8c42959a434bd9cabf283ac56872c996_1463635734.jpg',
    url: 'https://www.zomato.com/mumbai/happy-hours?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1',
    title: 'Happy Hours',
    description: 'Great deals on booze. Happy hours indeed',
    share_url: 'http://www.zoma.to/c-3/339' },
  { collection_id: 225,
    res_count: 37,
    image_url: 'https://b.zmtcdn.com/data/collections/3eeb8a5d63844348a56f85c8db028418_1443673408_l.jpg',
    url: 'https://www.zomato.com/mumbai/fine-dining-restaurants?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1',
    title: 'Luxury Dining',
    description: 'The best restaurants in town for a complete fine-dining experience.',
    share_url: 'http://www.zoma.to/c-3/225' } ]

cuisines

Get list of all cuisines in a city

Parameters

| Name | Type | Description | | :--------:| :----: | :-------------------------------------: | | options | Object | options containing the params to send |

Options

| Name | Type | Description | Required | | :-------: | :----: | :----------------------------------------------: | :------: | | city_id | Number | id of the city for which the cuisines are needed | No | | lat | Number | Latitude | No | | lon | Number | Longitude | No |

Returns

Promise

Example
zomato
  .cuisines({
    lat: 19.0895595,
    lon: 72.8634203
  })
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });
Sample Response
[ { cuisine_id: 6, cuisine_name: 'Afghani' },
  { cuisine_id: 152, cuisine_name: 'African' },
  { cuisine_id: 1, cuisine_name: 'American' },
  { cuisine_id: 2, cuisine_name: 'Andhra' },
  { cuisine_id: 4, cuisine_name: 'Arabian' },
  { cuisine_id: 175, cuisine_name: 'Armenian' },
  { cuisine_id: 3, cuisine_name: 'Asian' },
  { cuisine_id: 165, cuisine_name: 'Assamese' },
  { cuisine_id: 292, cuisine_name: 'Awadhi' },
  { cuisine_id: 193, cuisine_name: 'BBQ' },
  { cuisine_id: 5, cuisine_name: 'Bakery' },
  { cuisine_id: 227, cuisine_name: 'Bar Food' },
  { cuisine_id: 10, cuisine_name: 'Bengali' },
  { cuisine_id: 270, cuisine_name: 'Beverages' },
  { cuisine_id: 1013, cuisine_name: 'Bihari' },
  { cuisine_id: 7, cuisine_name: 'Biryani' },
  { cuisine_id: 133, cuisine_name: 'British' },
  { cuisine_id: 168, cuisine_name: 'Burger' },
  { cuisine_id: 22, cuisine_name: 'Burmese' },
  { cuisine_id: 30, cuisine_name: 'Cafe' },
  { cuisine_id: 994, cuisine_name: 'Charcoal Chicken' },
  { cuisine_id: 992, cuisine_name: 'Charcoal Grill' },
  { cuisine_id: 18, cuisine_name: 'Chettinad' },
  { cuisine_id: 25, cuisine_name: 'Chinese' },
  { cuisine_id: 161, cuisine_name: 'Coffee and Tea' },
  { cuisine_id: 35, cuisine_name: 'Continental' },
  { cuisine_id: 1014, cuisine_name: 'Cuisine Varies' },
  { cuisine_id: 100, cuisine_name: 'Desserts' },...]

establishments

Get list of restaurant types in a city

Parameters

| Name | Type | Description | | :-------: | :----: | :-------------------------------------: | | options | Object | options containing the params to send |

Options

| Name | Type | Description | Required | | :-------: | :----: | :----------------: | :------: | | city_id | Number | The id of the city | No | | lat | Number | Latitude | No | | lon | Number | Longitude | No |

Returns

Promise

Example
zomato
  .establishments({
    lat: 19.0895595,
    lon: 72.8634203
  })
  .then(function(data) {
    console.log(data);
  })
  .catch(function(err) {
    console.error(err);
  });
Sample Response
[ { id: 16, name: 'Casual Dining' },
  { id: 21, name: 'Quick Bites' },
  { id: 31, name: 'Bakery' },
  { id: 23, name: 'Dessert Parlour' },
  { id: 291, name: 'Sweet Shop' },
  { id: 41, name: 'Beverage Shop' },
  { id: 20, name: 'Food Court' },
  { id: 7, name: 'Bar' },
  { id: 1, name: 'Café' },
  { id: 18, name: 'Fine Dining' },
  { id: 6, name: 'Pub' },
  { id: 5, name: 'Lounge' },
  { id: 61, name: 'Dhaba' },
  { id: 8, name: 'Club' },
  { id: 4, name: 'Kiosk' },
  { id: 51, name: 'Butcher Shop' },
  { id: 81, name: 'Food Truck' },
  { id: 161, name: 'Microbrewery' },
  { id: 278, name: 'Wine Bar' } ]

geocode

Get location details based on coordinates

Parameters

| Name | Type | Description | | :-------: | :----: | :----

Related Skills

View on GitHub
GitHub Stars13
CategoryDevelopment
Updated1y ago
Forks3

Languages

JavaScript

Security Score

65/100

Audited on Apr 28, 2024

No findings