How to Get an ISO 3166–1 Standardized List of Countries in Node.JS

Cloudmersive
2 min readSep 15, 2020

--

Prioritizing standardization across your databases will allow your operations to run smoother and provide a better experience for your clients and partners. When working on an international scale, working based on normalized country names will aid in clarification and limit mistakes on location information. This API will provide you with access a list of ISO 3166–1 standardized country names along with their ISO two-letter codes.

First, we will need to install our client software:

npm install cloudmersive-validate-api-client --save

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

"dependencies": {
"cloudmersive-validate-api-client": "^1.2.4"
}

Then we can call our function, AddressCountryList:

var CloudmersiveValidateApiClient = require('cloudmersive-validate-api-client');
var defaultClient = CloudmersiveValidateApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveValidateApiClient.AddressApi();var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.addressCountryList(callback);

With that, you can ensure that your location data is always correct based on standard metrics. You can retrieve your API Key from the Cloudmersive website at no cost; it will give you access to up to 800 calls 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