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.

Summary

GetService
AppWebsocketClientConnectComplete
AppWebsocketClientMessage
Messages send to the service
Messages received by the service

GetService

The app service finds and connects to the right Service API:

class IService* service = NULL;
class AppSession* session = NULL;
for (auto pbxsession : app->pbxSessions) { //Look for the right app service
    if (pbxsession->services) {
        service = pbxsession->services->GetService("com.innovaphone.publicholidays");
        session = pbxsession;
        if (service) break;
    }
}
//If found then connect the appwebsocket client
if (service) this->awsClient->Connect(service->GetWebsocketUrl(), service->GetName(), session->services->CreateAuthenticator(), false);
else this->awsClient->Close();

AppWebsocketClientConnectComplete

Callback when the appwebsocket client has been connected, so you can start sending messages.

void App::AppWebsocketClientConnectComplete(class IAppWebsocketClient* appWebsocketClient)
{
    char sb[200];
    class json_io send(sb);
    word base = send.add_object(JSON_ID_ROOT, 0);
    send.add_string(base, "mt", "GetCountries");
    send.add_string(base, "api", "innovaphone-publicholidays-serviceapi");
    this->awsClient->MessageSend(send, sb);
    this->awsClient->MessageComplete();
}

AppWebsocketClientMessage

Function where the answers from the Working Client API are received.

void App::AppWebsocketClientMessage(class IAppWebsocketClient* appWebsocketClient, class json_io& msg, word base, const char* mt, const char* src)
{
    if (!strcmp(mt, "GetCountriesResult")) { //Manage the answers from the Publicholidays API
        ...
    }
    ...
}

Messages send to the service

GetCountries
GetStates
GetHolidays
IsHoliday

Messages received by the service

GetCountriesResult
GetStatesResult
GetHolidaysResult
IsHolidayResult

GetCountries

Gets all supported Countries of PublicHolidays

Parameters

string api"innovaphone-publicholidays-serviceapi"

GetCountriesResult

Answer to the start of the working time of an user.

Parameters

string result ["DE","AT","CH"]

GetStates

Gets all supported Countries of PublicHolidays

Parameters

string country"DE"
string api"innovaphone-publicholidays-serviceapi"

GetStatesResult

Gets all supported Countries of PublicHolidays

Parameters

string 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:

Parameters

string year"2025"
string country"DE"
string state"BW"
string api"innovaphone-publicholidays-serviceapi"

GetHolidaysResult

Retrieves all public holidays

Parameters

string 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:

Parameters

string date"2025-12-25"
string country"DE"
string state"BW"
string api"innovaphone-publicholidays-serviceapi"

IsHolidayResult

Allows you to check whether a given date is a public holiday

Parameters

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