How to Get a Country’s Regional Information in Node.JS

Knowing who your audience is and where they are from will help you understand your client base and tailor their experience. This information can also help you plan and execute business strategies that are reliant on time zones and knowledge of the EU membership status for your clients’ locations. The following API will allow you to retrieve regional information about any input country, including sub-region and continent data.

Image for post
Image for post

Our first step is to run this command to install the SDK:

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, you can call our function, AddressGetCountryRegion:

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 input = new CloudmersiveValidateApiClient.ValidateCountryRequest(); // ValidateCountryRequest | Input requestvar callback = function(error, data, response) {
if (error) {
} else {
console.log('API called successfully. Returned data: ' + data);
apiInstance.addressGetCountryRegion(input, callback);

Now, you will be supplied with an in-depth understanding of your clientele and their regional affiliations. To access your personal API Key, visit the Cloudmersive website. With this, you will gain access to 800 free monthly 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