Holiday Calendars

A Holiday Calendar defines site-wide holiday dates and optional partial-day windows that scheduled resources skip.

List Holiday Calendars

SDK Function

HolidayCalendar.list()

Return Object

ListIterator<HolidayCalendar>

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

import com.files.ListIterator;
import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.HolidayCalendar;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  ListIterator<HolidayCalendar> holidayCalendars = HolidayCalendar.list(parameters);
  for (HolidayCalendar holidayCalendar : holidayCalendars.listAutoPaging()) {
    // Operate on holidayCalendar
  }
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Show Holiday Calendar

SDK Function

HolidayCalendar.find()

Return Object

HolidayCalendar

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Function Arguments

ArgumentDescription
id
int64
Required
Holiday Calendar ID.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.HolidayCalendar;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  HolidayCalendar holidayCalendar = HolidayCalendar.find(id, parameters);
  // Operate on holidayCalendar
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Create Holiday Calendar

SDK Function

HolidayCalendar.create()

Return Object

HolidayCalendar

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Function Arguments

ArgumentDescription
definition
object
Required
Holiday rules for the calendar.
name
string
Required
Holiday Calendar name.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.HolidayCalendar;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("definition", {"months" => {"0" => [{"name" => "Good Friday", "function" => "easter(year)", "function_modifier" => -2}], "1" => [{"name" => "New Year's Day", "mday" => 1, "observed" => "to_weekday_if_weekend(date)"}, {"name" => "Third Monday", "week" => 3, "wday" => 1}], "11" => [{"name" => "Thanksgiving", "week" => 4, "wday" => 4}], "12" => [{"name" => "Christmas Eve Early Close", "mday" => 24, "start_time" => "13:00", "end_time" => "17:00", "year_ranges" => {"from" => 2026}}]}});
  parameters.put("name", "Company Holidays");
  
  HolidayCalendar holidayCalendar = HolidayCalendar.create(parameters);
  // Operate on holidayCalendar
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Update Holiday Calendar

SDK Function

holidayCalendar.update();

Return Object

HolidayCalendar

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Attribute Setters

SetterDescription
setDefinition
object
Holiday rules for the calendar.
setName
string
Holiday Calendar name.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.HolidayCalendar;

try {
  // Find the holidayCalendar object by its id.
  HolidayCalendar holidayCalendar = HolidayCalendar.find(id, null);
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("definition", {"months" => {"0" => [{"name" => "Good Friday", "function" => "easter(year)", "function_modifier" => -2}], "1" => [{"name" => "New Year's Day", "mday" => 1, "observed" => "to_weekday_if_weekend(date)"}, {"name" => "Third Monday", "week" => 3, "wday" => 1}], "11" => [{"name" => "Thanksgiving", "week" => 4, "wday" => 4}], "12" => [{"name" => "Christmas Eve Early Close", "mday" => 24, "start_time" => "13:00", "end_time" => "17:00", "year_ranges" => {"from" => 2026}}]}});
  holidayCalendar.update(parameters);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Delete Holiday Calendar

SDK Function

holidayCalendar.delete();

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.HolidayCalendar;

try {
  // Find the holidayCalendar object by its id.
  HolidayCalendar holidayCalendar = HolidayCalendar.find(id, null);
  holidayCalendar.delete(null);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

The HolidayCalendar Object

Some of the functions above return a HolidayCalendar object. The attributes of this object are listed below.

AttributeDescription
id
int64
Holiday Calendar ID. Set a scheduled resource's holiday_region to custom_ followed by this ID to make it skip the days in this calendar.
name
string
Holiday Calendar name.
definition
object
Holiday rules for the calendar.
created_at
date-time
Creation time.
updated_at
date-time
Last update time.

definition

Holiday rules grouped by month. A definition may contain at most 366 rules and its encoded JSON may be at most 65535 bytes.

Definition fields

AttributeDescription
months
object
Required
Keys 1 through 12 contain rules for that month. Key 0 contains calculated-date rules. At most 366 rules are allowed across all months.

Example definition

{
  "months": {
    "0": [
      {
        "name": "Good Friday",
        "function": "easter(year)",
        "function_modifier": -2
      }
    ],
    "1": [
      {
        "name": "New Year's Day",
        "mday": 1,
        "observed": "to_weekday_if_weekend(date)"
      },
      {
        "name": "Third Monday",
        "week": 3,
        "wday": 1
      }
    ],
    "11": [
      {
        "name": "Thanksgiving",
        "week": 4,
        "wday": 4
      }
    ],
    "12": [
      {
        "name": "Christmas Eve Early Close",
        "mday": 24,
        "start_time": "13:00",
        "end_time": "17:00",
        "year_ranges": {
          "from": 2026
        }
      }
    ]
  }
}

Rule types

Common rule options

Year restrictions