How to Get a List of Available Currencies & their Corresponding Countries with JavaScript
If you’re looking to integrate basic currency services into your app, you’re definitely going to need raw data about common available currencies. Exchange rates are only half of the equation — you’ll need currency codes, symbols, associated country names, information about European Union membership, and more. Our List Available Currencies API handles that task perfectly, enumerating an up-to-date list of available currencies and their respective country affiliations. There are no parameters to satisfy for this API call, so all you need to do is plug & play, and you’ll get information structured in the following format for each available currency:
{
"Currencies": [
{
"ISOCurrencyCode": "EUR",
"CurrencySymbol": "€",
"CurrencyEnglishName": "Euro",
"CountryName": "Andorra",
"CountryThreeLetterCode": "AND",
"CountryISOTwoLetterCode": "AD",
"IsEuropeanUnionMember": false
Below, ready-to-run code examples & instructions are provided to easily take advantage of this API with JavaScript.
Let’s first install the jQuery library. Include the below command to do so:
bower install jquery
After that, let’s include the Currency API function:
var settings = {
"url": "https://api.cloudmersive.com/currency/exchange-rates/list-available",
"method": "POST",
"timeout": 0,
"headers": {
"Apikey": "YOUR-API-KEY-HERE"
},
};$.ajax(settings).done(function (response) {
console.log(response);
});
Easy as pie. Include your Cloudmersive API key (obtainable by registering a free account on our website, Home — Cloudmersive APIs), and you’re good to go.