How to Get a List of Exchange Rates in Node.JS

Expanding your business to its fullest potential may often mean working with international clients and partners. Updating your website and other systems to accommodate different currencies will give you a leg up, especially if you can provide for exchange rates on site. With the API we are about to show you, you can retrieve a list of all current exchange rates along with their corresponding countries, currency symbols, ISO codes, and EU membership status to include in your online services.

Image for post
Image for post

Our first step in implementing this API is installing our client software:

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

You can also add this snippet to your package.json:

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

Then, we can call our function, CurrencyExchangeGetAvailableCurrencies:

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 callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.currencyExchangeGetAvailableCurrencies(callback);

With this, you can better and more easily serve your international partners’ needs. To retrieve your free, personal API Key, visit the Cloudmersive website and gain access to up to 800 calls across our library of APIs.

Written by

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store