How to Retrieve the Public Holidays for a Country in Node.JS

Cloudmersive
Nov 20, 2020

--

Working with entities internationally means being understanding of timelines and holidays that might interfere with plans. Furthermore, if your organization has locations in different countries, it is necessary to know the public holidays in those locations for your employees. The following API will retrieve all of the public holidays for a given year is a specified country, with support for over 100 countries.

To use this API, 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 the function:

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

This will return the English Name of the holiday, the local name, the date it occurs, the holiday type, and whether the holiday is nationwide.

You can retrieve the API Key from the Cloudmersive website at no cost and with no commitment. This will provide you with 800 monthly 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