How to Get a List of Common Currencies & Corresponding Countries using Go

Cloudmersive
2 min readDec 9, 2022

Calling our Currency Enumeration API is a simple and easy way to find a detailed list of all currencies available for conversion & exchange via the Cloudmersive Currency API endpoint. This API will provide a response body containing the ISO currency code, currency symbol, currency name (in English), country name, and several additional details.

To take advantage of this API alongside our other currency services, simply include the below code examples in your environment to structure your call and supply your Cloudmersive API key in the req.Header.Add field:

package main

import (
"fmt"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.cloudmersive.com/currency/exchange-rates/list-available"
method := "POST"

client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)

if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Apikey", "YOUR-API-KEY-HERE")

res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}

If you’re new to Cloudmersive APIs, getting a Cloudmersive API key is easy: just register a free account on our website (this provides a hard limit of 800 API calls per month; enterprise accounts are also available) and copy your key from the account page.

--

--

Cloudmersive

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