SDKs overview
The Non-Working Days API offers a programmatic interface to access comprehensive holiday data for over 250 countries, facilitating the development of applications that require accurate non-working day information. While Non-Working Days provides direct API access through its RESTful API documentation, developers often utilize client-side SDKs and libraries to simplify integration. These tools wrap the HTTP requests and responses, providing language-native objects and methods, reducing the boilerplate code required to interact with the API.
SDKs typically handle aspects such as API key authentication, request formatting, and response parsing, allowing developers to focus on integrating holiday data into their application logic. The Non-Working Days platform emphasizes developer experience, offering clear examples across various programming languages in its official API reference, which serves as a foundation for building custom client libraries or integrating directly.
Integrating third-party APIs using SDKs can streamline development by abstracting the HTTP layer, managing authentication, and providing type-safe access to API resources. For example, a Python SDK might expose methods like get_holidays(country, year), returning a list of holiday objects directly, rather than requiring manual construction of a URL, HTTP request, and JSON parsing. This approach is consistent with common practices for integrating web services, as seen in the Stripe API documentation for various SDKs.
Official SDKs by language
Non-Working Days primarily provides extensive API documentation and code examples across several popular programming languages, which serve as a foundation for direct integration or for developers to create their own client wrappers. While formal, standalone SDK packages might not be distributed with dedicated versioning for all languages, the provided examples are complete enough to function as quickstart libraries. The API is a standard HTTP-based REST API, making it accessible from any language capable of making HTTP requests.
| Language | Type | Description | Maturity |
|---|---|---|---|
| cURL | Command-line example | Direct HTTP request example for quick testing and integration. | Stable |
| Python | Code example / Client library pattern | Detailed examples for making requests and processing responses using requests library. |
Stable |
| JavaScript | Code example / Client library pattern | Browser and Node.js examples using fetch or axios for API interaction. |
Stable |
| PHP | Code example / Client library pattern | Examples demonstrating API calls using PHP's native HTTP functions or Guzzle. | Stable |
| Ruby | Code example / Client library pattern | Integration examples utilizing Ruby's HTTP client libraries. | Stable |
Installation
Since Non-Working Days primarily offers direct API access with comprehensive code examples rather than formal, installable SDK packages for all languages, installation typically involves setting up HTTP client libraries if not already part of the language's standard library. The core requirement is the ability to make HTTP GET requests and parse JSON responses. The following provides general installation steps for the most commonly used languages highlighted by Non-Working Days:
Python
For Python, the requests library is a common choice for making HTTP requests. It can be installed using pip:
pip install requests
After installation, you can import it into your Python script:
import requests
JavaScript (Node.js)
In Node.js environments, you might use node-fetch (if not targetting a modern Node.js version with native fetch) or axios. To install axios:
npm install axios
Then, require it in your JavaScript file:
const axios = require('axios');
For browser-based JavaScript, the native fetch API is generally available without additional installation, as detailed in Mozilla's Fetch API documentation.
PHP
For PHP, the Guzzle HTTP client is a robust option. Install it via Composer:
composer require guzzlehttp/guzzle
Include Composer's autoloader in your script:
require 'vendor/autoload.php';
Ruby
Ruby can use the standard library's Net::HTTP or a gem like httparty. To install httparty:
gem install httparty
Then require it in your Ruby script:
require 'httparty'
Quickstart example
This quickstart example demonstrates how to fetch public holidays for a specific country and year using the Non-Working Days API. You will need an API key, which can be obtained by signing up on the Non-Working Days homepage.
Python example
This Python snippet uses the requests library to make a GET request to the Non-Working Days API and prints the returned holidays.
import requests
import json
API_KEY = 'YOUR_API_KEY' # Replace with your actual API key
COUNTRY_CODE = 'US' # Example: United States
YEAR = 2026 # Example: Year 2026
BASE_URL = 'https://www.nonworkingdays.com/api/v1/holidays'
params = {
'api_key': API_KEY,
'country': COUNTRY_CODE,
'year': YEAR
}
try:
response = requests.get(BASE_URL, params=params)
response.raise_for_status() # Raise an exception for HTTP errors (4xx or 5xx)
holidays_data = response.json()
if holidays_data and 'holidays' in holidays_data:
print(f"Public holidays for {COUNTRY_CODE} in {YEAR}:")
for holiday in holidays_data['holidays']:
print(f" - {holiday['name']} on {holiday['date']}")
else:
print("No holidays found or unexpected response format.")
print(json.dumps(holidays_data, indent=2))
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
except json.JSONDecodeError:
print("Failed to decode JSON response.")
print(response.text)
JavaScript (Node.js) example
This Node.js example uses axios to fetch holiday data, demonstrating asynchronous API interaction.
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY'; // Replace with your actual API key
const COUNTRY_CODE = 'DE'; // Example: Germany
const YEAR = 2026; // Example: Year 2026
const BASE_URL = 'https://www.nonworkingdays.com/api/v1/holidays';
async function getHolidays() {
try {
const response = await axios.get(BASE_URL, {
params: {
api_key: API_KEY,
country: COUNTRY_CODE,
year: YEAR
}
});
const holidaysData = response.data;
if (holidaysData && holidaysData.holidays) {
console.log(`Public holidays for ${COUNTRY_CODE} in ${YEAR}:`);
holidaysData.holidays.forEach(holiday => {
console.log(` - ${holiday.name} on ${holiday.date}`);
});
} else {
console.log("No holidays found or unexpected response format.");
console.log(JSON.stringify(holidaysData, null, 2));
}
} catch (error) {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.error(`Error fetching holidays: ${error.response.status} - ${error.response.data.message}`);
} else if (error.request) {
// The request was made but no response was received
console.error("No response received:", error.request);
} else {
// Something happened in setting up the request that triggered an Error
console.error("Error:", error.message);
}
}
}
getHolidays();
Community libraries
While Non-Working Days provides direct API access and comprehensive examples, the developer community often creates and maintains third-party libraries to further streamline integration. These community-contributed SDKs can offer additional features, language-specific conventions, or frameworks integrations not covered by official examples. Developers often publish such libraries on package managers specific to their programming language (e.g., PyPI for Python, npm for JavaScript, RubyGems for Ruby).
To find community libraries, developers typically search respective package repositories or platforms like GitHub. When considering a community library, it's advisable to evaluate its maintenance status, documentation, and community support. Factors such as the number of stars, recent commits, and open issues on project repositories can indicate the health and reliability of a community-maintained solution. For instance, the Python Package Index (PyPI) is a central repository for Python libraries, where developers can search for existing clients.
As of 2026-05-29, specific, widely-adopted community-maintained SDKs for Non-Working Days are not predominantly featured on their official documentation, which prioritizes direct API usage with language examples. However, due to the RESTful nature of the API, it is straightforward for developers to create custom client libraries or adapt the provided examples to their specific needs. This approach allows for maximum flexibility and control over the integration process, aligning with patterns seen in other API-first services like the Google Maps Platform client libraries, which offer a mix of official and community-driven tools.