currencyapi
-
API version: v1
-
Build date: 2022-10-15T18:18:29.971705200-07:00[America/Los_Angeles]
The currency APIs help you retrieve exchange rates and convert prices between currencies easily.
Automatically generated by the OpenAPI Generator
Building the API client library requires:
- Java 1.8+
- Maven/Gradle
To install the API client library to your local Maven repository, simply execute:
mvn clean installTo deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn clean deployRefer to the OSSRH Guide for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>com.cloudmersive.gac</groupId>
<artifactId>cloudmersive-java-api-client-gac</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>Add this dependency to your project's build file:
repositories {
mavenCentral() // Needed if the 'cloudmersive-java-api-client-gac' jar has been published to maven central.
mavenLocal() // Needed if the 'cloudmersive-java-api-client-gac' jar has been published to the local maven repo.
}
dependencies {
implementation "com.cloudmersive.gac:cloudmersive-java-api-client-gac:4.1.2"
}At first generate the JAR by executing:
mvn clean packageThen manually install the following JARs:
target/cloudmersive-java-api-client-gac-4.1.2.jartarget/lib/*.jar
Please follow the installation instruction and execute the following Java code:
import com.cloudmersive.client.gac.invoker.*;
import com.cloudmersive.client.gac.invoker.auth.*;
import com.cloudmersive.client.gac.model.*;
import com.cloudmersive.client.gac.CurrencyExchangeApi;
public class CurrencyExchangeApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.cloudmersive.com");
// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");
CurrencyExchangeApi apiInstance = new CurrencyExchangeApi(defaultClient);
String source = "source_example"; // String | Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
String destination = "destination_example"; // String | Destination currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
Double sourcePrice = 3.4D; // Double | Input price, such as 19.99 in source currency
try {
ConvertedCurrencyResult result = apiInstance.currencyExchangeConvertCurrency(source, destination, sourcePrice);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CurrencyExchangeApi#currencyExchangeConvertCurrency");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}All URIs are relative to https://api.cloudmersive.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| CurrencyExchangeApi | currencyExchangeConvertCurrency | POST /currency/exchange-rates/convert/{source}/to/{destination} | Converts a price from the source currency into the destination currency |
| CurrencyExchangeApi | currencyExchangeGetAvailableCurrencies | POST /currency/exchange-rates/list-available | Get a list of available currencies and corresponding countries |
| CurrencyExchangeApi | currencyExchangeGetExchangeRate | POST /currency/exchange-rates/get/{source}/to/{destination} | Gets the exchange rate from the source currency into the destination currency |
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: Apikey
- Location: HTTP header
It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.