SDKs overview
Amdoren offers a suite of tools designed to facilitate integration with its currency exchange rate and currency converter APIs. These Software Development Kits (SDKs) and community-contributed libraries abstract the underlying HTTP requests, authentication mechanisms, and JSON response parsing, allowing developers to focus on application logic rather than API communication specifics. The primary goal of these SDKs is to reduce the boilerplate code required to fetch and display real-time exchange rates or perform currency conversions within various programming environments. Developers can find comprehensive guides within the Amdoren API documentation to assist with setup and usage.
The Amdoren API itself is a RESTful service, returning data in JSON format, which means it can be consumed by any programming language capable of making HTTP requests and parsing JSON. However, using an SDK can streamline this process significantly, especially for common tasks like retrieving the latest rates or converting amounts between currencies. The availability of both official and community-supported libraries ensures that developers have options regardless of their preferred language or framework. The official SDKs are maintained directly by Amdoren, offering guaranteed compatibility and support, while community libraries provide additional flexibility and often cater to niche use cases or specific language idioms.
Official SDKs by language
Amdoren provides official SDKs for several popular programming languages, ensuring direct support and continuous updates from the Amdoren team. These SDKs are designed to offer a consistent and reliable interface for accessing the Amdoren API's functionalities. Each official SDK typically handles API key management, request signing (if applicable), and robust error handling, which are critical for production-grade applications. Developers are encouraged to consult the Amdoren API reference for the most up-to-date information on supported SDKs and their specific features.
The following table outlines the officially supported SDKs, including their respective package names, installation commands, and maturity levels:
| Language | Package Name | Installation Command | Maturity |
|---|---|---|---|
| Python | amdoren-python |
pip install amdoren-python |
Stable |
| PHP | amdoren/php-sdk |
composer require amdoren/php-sdk |
Stable |
| Node.js | @amdoren/node-sdk |
npm install @amdoren/node-sdk |
Stable |
| Ruby | amdoren-ruby |
gem install amdoren-ruby |
Stable |
| Java | com.amdoren:java-sdk |
Maven: <dependency><groupId>com.amdoren</groupId><artifactId>java-sdk</artifactId><version>1.0.0</version></dependency> |
Stable |
Installation
Installing an Amdoren SDK typically involves using the package manager specific to your chosen programming language. These package managers automate the process of downloading the library and its dependencies, making it straightforward to integrate into your project. Below are detailed installation steps for the official SDKs:
Python
To install the Python SDK, use pip, the standard package installer for Python:
pip install amdoren-python
Ensure you have a recent version of Python and pip installed. You can verify your pip installation by running pip --version in your terminal. For virtual environments, activate your environment before running the install command.
PHP
For PHP projects, Composer is the recommended tool for dependency management. If you don't have Composer, follow the instructions on the Composer download page to install it. Then, run the following command in your project root:
composer require amdoren/php-sdk
This command adds the Amdoren PHP SDK to your composer.json file and installs it into your vendor/ directory.
Node.js
The Node.js SDK is available via npm (Node Package Manager). Navigate to your project directory and execute:
npm install @amdoren/node-sdk
Alternatively, if you prefer Yarn:
yarn add @amdoren/node-sdk
This will add the SDK to your package.json dependencies.
Ruby
For Ruby applications, use RubyGems to install the SDK:
gem install amdoren-ruby
After installation, you can require the gem in your Ruby scripts or applications.
Java
For Java projects, the Amdoren SDK is typically managed using Maven or Gradle. Here's how to include it in your pom.xml (Maven) or build.gradle (Gradle) file:
Maven
<dependency>
<groupId>com.amdoren</groupId>
<artifactId>java-sdk</artifactId>
<version>1.0.0</version> <!-- Use the latest version -->
</dependency>
Gradle
implementation 'com.amdoren:java-sdk:1.0.0' // Use the latest version
Replace 1.0.0 with the latest available version, which can be found in the Amdoren Java SDK documentation.
Quickstart example
This quickstart example demonstrates how to fetch the latest exchange rates using the Amdoren Python SDK. This snippet illustrates the basic steps of initializing the client with an API key and making a request to retrieve currency data. Ensure you have installed the amdoren-python package as described in the Installation section.
First, obtain your API key from your Amdoren account dashboard. The free tier provides 5,000 requests per month, which is sufficient for initial testing and development purposes. Paid plans offer higher request limits, starting at $15/month for 25,000 requests.
import os
from amdoren_python import AmdorenClient
# Replace 'YOUR_API_KEY' with your actual Amdoren API key
# It's recommended to use environment variables for API keys in production
api_key = os.getenv('AMDOTEN_API_KEY', 'YOUR_API_KEY')
client = AmdorenClient(api_key)
try:
# Fetch latest exchange rates, e.g., USD to EUR
# The 'from' and 'to' parameters specify the base and target currencies.
# For a full list of supported currencies, refer to the Amdoren API documentation.
response = client.latest_rates(from_currency='USD', to_currency='EUR')
if response['success']:
rate = response['rates']['EUR']
print(f"1 USD = {rate} EUR")
# Example: Convert 100 USD to EUR
amount_to_convert = 100
converted_amount_response = client.convert_currency(
from_currency='USD',
to_currency='EUR',
amount=amount_to_convert
)
if converted_amount_response['success']:
converted_value = converted_amount_response['amount']
print(f"{amount_to_convert} USD = {converted_value} EUR")
else:
print(f"Error converting currency: {converted_amount_response['error']}")
else:
print(f"Error fetching rates: {response['error']}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
This example initializes the AmdorenClient with the API key, then makes two requests: one to get the latest USD to EUR exchange rate and another to convert a specific amount. The API returns a JSON object containing the success status, rates, or an error message. Developers should always implement error handling to gracefully manage API failures or invalid responses, as demonstrated in the try-except block.
Community libraries
Beyond the official SDKs, the developer community has contributed various libraries and wrappers for the Amdoren API. These community-driven projects often cater to specific frameworks, offer alternative API interaction patterns, or provide utilities not present in the official SDKs. While not officially supported by Amdoren, they can be valuable resources for developers working in specific environments or with particular requirements. When considering a community library, it is advisable to check its maintenance status, documentation, and community activity to ensure it meets your project's needs.
Platforms like GitHub are common repositories for these projects. Searching for "Amdoren API" or "Amdoren currency" on package managers like npm, PyPI, or RubyGems can reveal community contributions. For instance, developers might find a JavaScript library specifically designed for front-end frameworks like React or Vue, or a GoLang wrapper for server-side applications. Although Amdoren's core functionality is straightforward, these community libraries can sometimes offer convenience layers or integrations with other services. For example, a developer might create a library that integrates Amdoren's exchange rates directly into a spreadsheet application or a specific CMS, extending its utility beyond direct API calls. When using any third-party library, it's good practice to review its source code for security and performance considerations, as recommended by general web security best practices.