1.0.0 • Published 1 year ago

ambee-node-sdk v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Ambee Node SDK

This is an npm package that provides a convenient and easy-to-use interface to the Ambee API. With this package, you can retrieve real-time data about air quality, weather, and pollen levels in a specific location.

Installation

Using npm:

npm i ambee-node-sdk 

Usage

To use the Ambee Node SDK, you will need an API Key. To get an API Key, sign up at API Dashboard .

Once you have an API Key, you can use it in your application as follows:

const Ambee = require('ambee-node-sdk');

const ambee = new Ambee('YOUR-API-KEY');

Available Methods

The following methods are available for Air class:

geospatialSearchLatest(lat, lng)

Get air quality latest data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
ambee.air.geospatialSearchLatest(12, 77);

geospatialSearchHistory(lat, lng, optionalParameters = {})

Get air quality history data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
  • optionalParameters: An object containing the following parameters.
    • from: Start time in format YYYY-MM-DD HH:mm:ss.
    • to: End time in format YYYY-MM-DD HH:mm:ss.
ambee.air.geospatialSearchHistory(12, 77, { from: '2023-04-25 14:00:00', to: '2023-04-25 16:00:00' });

postalCodeSearchLatest(postalCode, countryCode)

Get air quality latest data based on a postal code and country code of a location.

  • postalCode: The postal code of the location.
  • countryCode: The country code of the location.
ambee.air.postalCodeSearchLatest('560020', 'IN');

postalCodeSearchHistory(postalCode, countryCode, optionalParameters = {})

Get air quality latest data based on a postal code and country code of a location.

  • postalCode: The postal code of the location.
  • countryCode: The 2 digit ISO country code of the country to search.
  • optionalParameters: An object containing the following optional parameters.
    • from: Start time in format YYYY-MM-DD HH:mm:ss.
    • to: End time in format YYYY-MM-DD HH:mm:ss.
ambee.air.postalCodeSearchHistory('560020', 'IN', { from: '2023-04-25 14:00:00', to: '2023-04-25 16:00:00' });

cityWiseSearch(city, optionalParameters = {})

Get air quality data based on city name.

  • city: The name of the city.
  • optionalParameters: An object containing the following optional parameters.
    • limit: The number of records to be returned.
ambee.air.cityWiseSearch('Bengaluru', { limit: 2});

countryWiseSearch(countryCode, optionalParameters = {})

Get air quality data based on country code.

  • countryCode: The 2 digit ISO country code of the country to search.
  • optionalParameters: An object containing the following optional parameters.
    • limit: The number of records to be returned.
ambee.air.countryWiseSearch('IN', { limit: 2});

The following methods are available for Weather class:

geospatialSearchLatest(lat, lng, optionalParameters= {})

Get latest weather data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
  • optionalParameters: An object containing the following optional parameters.
    • units: The weather parameters in 'si' or 'metrics' units.
ambee.weather.geospatialSearchLatest(12, 77, { units: 'si' });

geospatialSearchHistory(lat, lng, optionalParameters = {})

Get weather history data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
  • optionalParameters: An object containing the following parameters.
    • from: Start time in format YYYY-MM-DD HH:mm:ss.
    • to: End time in format YYYY-MM-DD HH:mm:ss.
    • units: The weather parameters in 'si' or 'metrics' units. (optional)
ambee.weather.geospatialSearchHistory(12, 77, { from: '2023-04-25 14:00:00', to: '2023-04-25 16:00:00', units: 'si' });

geospatialSearchDaily(lat, lng, optionalParameters = {})

Get weather history (daily) data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
  • optionalParameters: An object containing the following parameters.
    • from: Start time in format YYYY-MM-DD HH:mm:ss.
    • to: End time in format YYYY-MM-DD HH:mm:ss.
    • units: The weather parameters in 'si' or 'metrics' units. (optional)
ambee.weather.geospatialSearchDaily(12, 77, { from: '2023-04-25 14:00:00', to: '2023-04-25 16:00:00', units: 'si' });

geospatialSearchForecast(lat, lng, optionalParameters = {})

Get weather forecast data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
  • optionalParameters: An object containing the following optional parameters.
    • units: The weather parameters in 'si' or 'metrics' units.
ambee.weather.geospatialSearchForecast(12, 77, { units: 'si' });

geospatialSearchSevere(lat, lng, optionalParameters = {})

Get weather alert data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
  • optionalParameters: An object containing the following optional parameters.
    • units: The weather parameters in 'si' or 'metrics' units.
ambee.weather.geospatialSearchSevere(12, 77, { units: 'si' });

placeWiseSearch(place, optionalParameters = {})

Get weather data based on name of the place.

  • place: Name of the place to search or postalcode followed by country. (for eg. 'Malleswaram,Bangalore' or '560020,India')
  • optionalParameters: An object containing the following optional parameters.
    • units: The weather parameters in 'si' or 'metrics' units.
ambee.weather.placeWiseSearch('Malleswaram,Bangalore', { units: 'si' });

The following methods are available for Pollen class:

geospatialSearchLatest(lat, lng, optionalParameters = {})

Get latest pollen data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
  • optionalParameters: An object containing the following optional parameters.
    • speciesRisk: Possible values 'true' or 'false'. Defaults to 'false'.
ambee.pollen.geospatialSearchLatest(12, 77, { speciesRisk: true });

geospatialSearchHistory(lat, lng, optionalParameters = {})

Get pollen history data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
  • optionalParameters: An object containing the following parameters.
    • from: Start time in format YYYY-MM-DD HH:mm:ss.
    • to: End time in format YYYY-MM-DD HH:mm:ss.
    • speciesRisk: Possible values 'true' or 'false'. Defaults to 'false'. (optional)
ambee.pollen.geospatialSearchHistory(12, 77, { from: '2023-04-25 14:00:00', to: '2023-04-25 16:00:00', speciesRisk: true });

geospatialSearchForecast(lat, lng, optionalParameters = {})

Get pollen forecast data based on a geographical location.

  • lat: The latitude of the location.
  • lng: The longitude of the location.
  • optionalParameters: An object containing the following optional parameters.
    • speciesRisk: Possible values 'true' or 'false'. Defaults to 'false'.
ambee.pollen.geospatialSearchForecast(12, 77, { speciesRisk: true });

placeWiseSearchLatest(place, optionalParameters = {})

Get latest pollen data based on name of the place.

  • place: Name of the place to search or postalcode followed by country. (for eg. 'Malleswaram,Bangalore' or '560020,India')
  • optionalParameters: An object containing the following optional parameters.
    • speciesRisk: Possible values 'true' or 'false'. Defaults to 'false'.
ambee.pollen.geospatialSearchForecast('Malleswaram,Bangalore', { speciesRisk: true });

placeWiseSearchHistory(place, optionalParameters = {})

Get pollen history data based on name of the place.=

  • place: Name of the place to search or postalcode followed by country. (for eg. 'Malleswaram,Bangalore' or '560020,India')
  • from: Start time in format YYYY-MM-DD HH:mm:ss.
  • to: End time in format YYYY-MM-DD HH:mm:ss.
  • optionalParameters: An object containing the following parameters.
    • speciesRisk: Possible values 'true' or 'false'. Defaults to 'false'. (optional)
ambee.pollen.placeWiseSearchHistory('Malleswaram,Bangalore', { from: '2023-04-25 14:00:00', to: '2023-04-25 16:00:00', speciesRisk: true });

placeWiseSearchForecast(place, optionalParameters = {})

Get pollen forecast data based on a geographical location.

  • place: Name of the place to search or postalcode followed by country. (for eg. 'Malleswaram,Bangalore' or '560020,India')
  • optionalParameters: An object containing the following optional parameters.
    • speciesRisk: Possible values 'true' or 'false'. Defaults to 'false'.
ambee.pollen.placeWiseSearchForecast('Malleswaram,Bangalore', { speciesRisk: true });

API Reference

For more information on the available methods and their parameters, please refer to the API Reference section of the official documentation.

Support

If you have any questions or issues, please feel free to visit Ambee Support.

1.0.0

1 year ago