How to Get the USD to EUR Exchange Rate in Node.JS

Cloudmersive
2 min readSep 18, 2020

--

Keeping accurate, up-to-date exchange rate data available for both you and your clients is important as you enter the global market. Being able to track trends and understand the flow of international currencies will allow you to organically grow your enterprise and plan effective strategies through research. Below, you will see an API that will allow you to automatically track currency conversions from a source currency, such as USD, to a destination currency, such as EUR through constantly updating exchange rate data.

First, we will need to install our client:

npm install cloudmersive-currency-api-client --save

Or, you can add this snippet to your package.json:

"dependencies": {
"cloudmersive-currency-api-client": "^1.2.0"
}

Then, we can call our function, CurrencyExchangeGetExchangeRate:

var CloudmersiveCurrencyApiClient = require('cloudmersive-currency-api-client');
var defaultClient = CloudmersiveCurrencyApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveCurrencyApiClient.CurrencyExchangeApi();var source = "source_example"; // String | Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc.var destination = "destination_example"; // String | Destination currency three-digit code (ISO 4217), e.g. USD, EUR, etc.var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.currencyExchangeGetExchangeRate(source, destination, callback);

Now, your organization can stay current on all exchange rate trends and boost your presence in international trade. You can retrieve your personal API key from the Cloudmersive website. This will give you access to 800 free calls per month across our library of APIs.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet