Module interzoid.weatherzip
ballerinax/interzoid.weatherzip Ballerina library
Overview
The Interzoid Weather Zip connector lets Ballerina applications retrieve current weather conditions for a US zip code from the Interzoid Current Weather Zip Code API. It supports version 1.0.0 of the API, which returns the city, state, temperature, conditions, wind, humidity, visibility, precipitation, wind chill and heat index for a given zip code.
Key features
- Get current weather conditions for any US zip code
- Read temperature in both Fahrenheit and Celsius, along with wind speed, direction, humidity and visibility
- Check the remaining credits on your Interzoid API license with every call
Setup guide
To use the connector, you need an Interzoid API license key.
-
Register for an account at Interzoid.
-
Copy the API license key issued for your account. The connector sends it in the
licensequery parameter.
Quickstart
To use the Interzoid Weather Zip connector in your Ballerina application, update the .bal file as follows:
Step 1: Import the module
import ballerinax/interzoid.weatherzip;
Step 2: Create a Config.toml file
licenseKey = "<Interzoid API license key>"
Step 3: Create a client
configurable string licenseKey = ?; final weatherzip:Client interzoid = check new ({license: licenseKey});
Step 4: Invoke an operation
public function main() returns error? { weatherzip:WeatherResponse _ = check interzoid->getWeatherByZipCode(zip = "14201"); }
Examples
The Interzoid Weather Zip connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
- City weather report - Look up the current weather for a list of US zip codes and print a summary line for each.
- Weather alert monitor - Flag zip codes whose wind speed or temperature crosses configured thresholds.