ballerinax/openweathermap Ballerina library

1.5.2

Overview

The Open Weather Map API v2.5 connector(https://openweathermap.org/) OpenAPI Specification.

The Open Weather Map API provides access to current weather data and weather forecast of any location worldwide including 200,000 cities by consuming the Current Weather Data and One Call API endpoints.

Key Features

  • Programmatic access to create and manage resources via REST API
  • Manage user accounts and profiles
  • Secure authentication with API key or OAuth support

Prerequisites

  • Create OpenWeatherMap account.
    • Choose a subscription that matches with your requirements
  • Obtain Api Key

Quickstart

To use the Open Weather Map connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

Copy
import ballerinax/openweathermap;

Step 2: Create a new connector instance

Provide the obtained API Key in client configuration.

Copy
openweathermap:ApiKeysConfig config = {
    appid : "<your appid>"
};

openweathermap:Client openweatherClient = check new Client(config);

Step 3: Invoke connector operation

  1. Obtain current weather data by city name.
Copy
openweathermap:CurrentWeatherData result = check openweatherClient->getCurretWeatherData("Colombo");
log:printInfo("Colombo Current Weather data : " + result.toString());
  1. Use bal run command to compile and run the Ballerina program.

Import

import ballerinax/openweathermap;Copy

Other versions

See more...

Metadata

Released date: 3 days ago

Version: 1.5.2

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.8.0

GraalVM compatible: Yes


Pull count

Total: 5446

Current verison: 2


Weekly downloads


Source repository


Keywords

Type/Connector

Vendor/OpenWeatherMap

Area/Productivity & Collaboration

Lifestyle & Entertainment/News & Lifestyle

Cost/Freemium


Contributors