Docs
Java Currency Exchange Rate API Documentation

Java Currency Exchange Rate API Documentation

Learn how to effectively use our Java-based Currency Exchange Rate API for real-time currency conversion.

Discover our robust and easy-to-use Currency Exchange Rate API for Java, designed to deliver accurate and reliable exchange rates for both personal and professional projects.

Why Choose Our Java Currency Exchange Rate API?

Our API is designed for simplicity, allowing you to fetch exchange rates with straightforward GET requests. Seamlessly integrate it into your Java applications without the need for complex dependencies.

With our API, you'll receive JSON responses that are not only fast and efficient but also easily readable. Java's native libraries for JSON handling make it simple to parse the data and integrate it into your projects with minimal effort.

For detailed information on the various request types we support, please refer to our Main Documentation.

Getting Started: Java Currency Conversion Example

To begin, you'll need to sign up for a free account and obtain your API key. Register here to get started.

Below is a simple Java code example for currency conversion using Google's GSON library.

// Setting URL
String url_str = "https://api.currencyexchangerate-api.com/v1/YOUR-API-KEY/latest/USD";
 
// Making Request
URL url = new URL(url_str);
HttpURLConnection request = (HttpURLConnection) url.openConnection();
request.connect();
 
// Convert to JSON
JsonParser jp = new JsonParser();
JsonElement root = jp.parse(new InputStreamReader((InputStream) request.getContent()));
JsonObject jsonobj = root.getAsJsonObject();
 
// Accessing object
String req_result = jsonobj.get("result").getAsString();
 

Sample JSON Response

Here’s a sample JSON response from the API with USD as the base currency code:

{
  "result": "success",
  "base_code": "USD",
  "qouta": 100,
  "remining": 78,
  "conversion_rates": {
    "USD": 1,
    "AED": 3.6725,
    "AFN": 71.3023,
    ...
  }
}

For additional details on request types, error handling, and more, please visit our Main Documentation.

Need Help?

If you have any questions or need further assistance, don’t hesitate to contact us. We’re here to assist you!