Java Client Library for Global Exchange Rates API

Integrating with the Global Exchange Rates API is straightforward via our JSON and XML endpoints. To simplify things for Java developers, we’ve released an official Java client library available on Maven Central.

This library works well with standard Java projects and is fully compatible with Android development, making it easy to add reliable exchange rate data to mobile apps or backend services.

You can find the package here: globalexchangerates-client on Maven Central.

Getting Started

Add the dependency to your project:

Maven

<dependency>
<groupId>org.globalexchangerates</groupId>
<artifactId>globalexchangerates-client</artifactId>
<version>1.0.0</version>
</dependency>

Gradle

implementation 'org.globalexchangerates:globalexchangerates-client:1.0.0'

Usage

Create an instance of the client with your API key:

GlobalExchangeRatesClient client = new GlobalExchangeRatesClient("your_api_key");

You can then call API methods asynchronously. For example, fetching the latest exchange rates:

javaCopiaModificaCompletableFuture<ExchangeRateResponse> ratesFuture = client.getLatestAsync(null, null, null);
ratesFuture.thenAccept(rates -> {
    System.out.println("Base currency: " + rates.getBase());
    System.out.println("Provider: " + rates.getProvider());
    System.out.println("Date: " + rates.getDate());
    rates.getExchangeRates().forEach((currency, rate) -> 
        System.out.println(currency + ": " + rate));

If you’re building Java or Android apps that need currency exchange data, this client library should help you integrate our API quickly and reliably.