# com.innovaphone.publicholidays

This API provides access to public holiday data, including region-specific holidays. It supports retrieving holiday lists and checking if a specific date is a holiday in a given region. More countries and regions will be added in the future.

## Messages

GetCountries
GetStates
GetHolidays
IsHoliday

### Question

Gets all supported Countries of PublicHolidays

    {
        mt:   "GetCountries"
    }

#### Response

    {
        mt:        "GetCountriesResult",
        result:   ["DE","AT","CH"]
    }

### GetStates

Gets all supported states of a given country

    {
        mt:   "GetStates",
        country: "DE"
    }

#### Response

        {
        mt:        "GetStatesResult",
        result: ["BW","BY","BE","BB","HB","HH","HE","MV","NI","NW","RP","SL","SN","ST","SH","TH"]
        }

### GetHolidays

Retrieves all public holidays for a given year, country and, optionally, a specific state. If no state is specified, only nationwide holidays (valid in all states) are returned.
You will get an array with an object for each day:

- date: date of this public holiday
- name: Localname (actually only german)
- international: international name

    {
        mt:   "GetHolidays",
        year: "2025",
        country: "DE",
        state: "BW",
    }

#### Response

        {
        mt:        "GetHolidaysResult",
        result: [{
        "date": "2025-01-01",
        "international": "New Year's Day",
        "name": "Neujahr"
        },
            {...}]
        }

### IsHoliday

Allows you to check whether a given date is a public holiday in a specified country, optionally, a specific state.
The date has to be in the format YY-MM-DD.
You will get an object as result:

- (date): date of this public holiday
- (name): Localname (actually only german)
- (international): international name
- isholiday: true or false

    {
        mt:   "IsHoliday",
        date: "2025-12-25",
        country: "DE",
        state: "BW",
    }

#### Response

        {
        mt:        "IsHolidayResult",
        result: [{date:"2025-12-25", name: "1. Weihnachtstag", international: "Christmas Day", isHolidays: true}]
        }

## Example

You can consume the API com.innovaphone.publicholidays and send request to it.

        var holidaysApi = start.consumeApi("com.innovaphone.publicholidays");

        holidaysApi.send({ mt: "GetCountries" });
        holidaysApi.send({ mt: "GetStates", country: "DE" });
        holidaysApi.send({ mt: "GetHolidays", year: "2025", country: "DE" });
        holidaysApi.send({ mt: "IsHoliday", date: "2025-12-25", country: "DE" });

        holidaysApi.onmessage.attach(function (sender, obj) {
            console.log("HolidayApi: + "JSON.stringify(obj.msg));
        });