ballerinax/openweathermap Ballerina library

1.5.1

Overview

This is a generated connector from Open Weather Map API v2.5 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.

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

Metadata

Released date: 12 months ago

Version: 1.5.1

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.4.1

GraalVM compatible: Yes


Pull count

Total: 5023

Current verison: 305


Weekly downloads


Source repository


Keywords

Lifestyle & Entertainment/News & Lifestyle

Cost/Freemium


Contributors

Other versions

See more...