The Open Weather Maps connector allows you to fetch data from Open Weather Maps based on city name, zip, id etc. It also allows to fetch data over a circle or a box of coordinates.
Import the libary from kasvith/openweathermaps
to your project
import kasvith/openweathermap
Visit Open Weather Maps and Grab a APPID by registering.
To initialize client after obtaining APPID you need to select language and metrics. They are defaulted to English and Kelvin(for temperature).
openweathermap:OpenWeatherMapClient owmClient = new({
appid: "YOUR_APP_ID"
});
var result = owmClient->getWeatherByCityName("Colombo");
io:println(result);
var result = owmClient->getWeatherByCityCoordinates({lat: 10, lon: 10});
io:println(result);
You need Ballerina 0.990.3 for development