Module interzoid.currencyrate
ballerinax/interzoid.currencyrate Ballerina library
Overview
The Interzoid Currency Rate connector lets Ballerina applications retrieve live currency exchange rates from the Interzoid Live Currency Exchange Rates API. It supports version 1.0.0 of the API, which returns the name, country, current rate and remaining API credits for a given currency symbol.
Key features
- Retrieve the live exchange rate for a currency symbol such as
EURorUSD - Get the currency name and the country or region it is associated with
- 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 Currency Rate connector in your Ballerina application, update the .bal file as follows:
Step 1: Import the module
import ballerinax/interzoid.currencyrate;
Step 2: Create a Config.toml file
licenseKey = "<Interzoid API license key>"
Step 3: Create a client
configurable string licenseKey = ?; final currencyrate:Client interzoid = check new ({license: licenseKey});
Step 4: Invoke an operation
public function main() returns error? { currencyrate:CurrencyRate _ = check interzoid->getCurrencyRate(symbol = "EUR"); }
Examples
The Interzoid Currency Rate connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
- Currency rate lookup - Look up the live exchange rate for a single currency and check the call succeeded.
- Multi-currency rate report - Build a rate report for a list of currencies, stopping early if the API credits run out.