Festivo Holiday API
CalendarA Quick Introduction to the Festivo API
Festivo is a platform that makes it easy for businesses to manage their holiday and time off requests. Their API allows developers to programmatically interact with their service.
Getting Started
To get started, you'll first need to create an account with Festivo and obtain an API key. Once you have your API key, you can start making requests to their API.
Authentication
Authentication is done through sending your API key as an HTTP header when making requests. Here is an example:
const fetch = require('node-fetch');
const apiKey = 'YOUR_API_KEY_HERE';
const headers = {
'Authorization': `Bearer ${apiKey}`
};
fetch('https://api.getfestivo.com/v1/holidays', { headers })
.then(response => response.json())
.then(data => console.log(data));
Examples
Retrieving Holidays
To retrieve a list of all holidays for a specific country and year, you can make a GET request to the /holidays
endpoint with the appropriate query parameters. Here is an example:
const fetch = require('node-fetch');
const apiKey = 'YOUR_API_KEY_HERE';
const headers = {
'Authorization': `Bearer ${apiKey}`
};
const country = 'us';
const year = '2021';
fetch(`https://api.getfestivo.com/v1/holidays?country=${country}&year=${year}`, { headers })
.then(response => response.json())
.then(holidays => {
holidays.forEach(holiday => console.log(holiday.name));
});
Managing Time Off Requests
To create a new time off request, you can make a POST request to the /time-off-requests
endpoint with the appropriate data in the request body. Here is an example:
const fetch = require('node-fetch');
const apiKey = 'YOUR_API_KEY_HERE';
const headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
};
const requestData = {
start_date: '2022-01-01',
end_date: '2022-01-05',
reason: 'Vacation',
note: 'Taking the family on a ski trip.'
};
fetch('https://api.getfestivo.com/v1/time-off-requests', {
headers,
method: 'POST',
body: JSON.stringify(requestData)
}).then(response => response.json())
.then(data => console.log(data));
Conclusion
The Festivo API makes it easy to manage holiday and time off requests programmatically. With the examples above, you can quickly get started on integrating Festivo into your application. Check out their documentation for a full list of endpoints and features.