Calendar functions

The calendar module handles all functionality regarding calendars in the Boka Connect SDK. These functions resides in the namespace Boka.calendar and should be prefixed as such.

getForSystem()

Description:

The getForSystem() command fetches a list of calendars for the authenticated user.

URL:

[GET] https://api.boka.se/rest/system/<system_id>/displayablecalendar

Response:

Returns an array of calendar objects.

Usage:

Boka.calendar.getForSystem(params, callback);

params is an object containing the following properties.

Key Value
systemId Unique identifier for the booking system.

callback is a function called with a return callback parameter containing an array with the following calendar data.

Response:

Key Data type Value
Id string Unique identifier.
Name string Calendar name.
Description string Description of the calendar.
Metadata object Additional metadata stored for the calendar.

Example:

Boka.calendar.getForSystem({
    systemId: 'xxc664',    
    }, function (calendarData) {
        if (calendarData.success){
            console.log(calendarData.result[0].name);
        }
    }
);

get() *

Description:

The get() command fetches details about a specific calendar.

Note: A public variant of this command is available. For this to work, the calendar security level must not be set to 'private'.

URL:

[GET] https://api.boka.se/rest/system/<system_id>/calendar/<calendar_id>

Public URL:

[GET] https://api.boka.se/rest/public/system/<system_id>/calendar/<calendar_id>

Response:

Returns a calendar object.

Usage:

Boka.calendar.get(params, callback);

params is an object containing the following properties.

Key Value
systemId Unique identifier for the system where the calendar resides.
calendarId Unique identifier for the calendar.
[asPublic] Boolean indicating if the public data should be retrieved.

callback is a function called with a return callback parameter containing the following calendar data.

Example:

Boka.calendar.get({
    systemId: 'xxc664',    
    calendarId: 'yyz112',    
    }, function (calendarData) {
        if (calendarData.success){
            console.log(calendarData.result.name);
        }
    }
);

getMerchantId()

Description:

The getMerchantId() command fetches the stored merchant id for a specific calendar used in conjunction with Boka Payments.

Note: To use this function, you will need to either add the header X-Boka-App-Id to your call or set the parameter appKey if you're using the SDK. The App ID will only be provided to verified partners of Boka.

URL:

[GET] https://api.boka.se/rest/system/<system_id>/calendar/<calendar_id>/merchantId

Response:

Returns an integer.

Usage:

Boka.calendar.getMerchantId(params, callback);

params is an object containing the following properties.

Key Value
systemId Unique identifier for the system where the calendar resides.
calendarId Unique identifier for the calendar.
appKey Identifier for the application making the call.

callback is a function called with a return callback parameter containing the merchant id.

Example:

Boka.calendar.getMerchantId({
    systemId: 'xxc664',    
    calendarId: 'yyz112',
    appKey: 'xvv998'
    }, function (merchantData) {
        if (merchantData.success){
            console.log(merchantData.result.merchantId);
        }
    }
);

getDisplayableForSystem()

Description:

The getDisplayableForSystem() command fetches a list of calendars, which are set to be displayable, for the authenticated user.

URL:

[GET] https://api.boka.se/rest/system/<system_id>/displayablecalendar

Response:

Returns an array of calendar objects.

Usage:

Boka.calendar.getDisplayableForSystem(params, callback);

params is an object containing the following properties.

Key Value
systemId Unique identifier for the booking system.

callback is a function called with a return callback parameter containing an array with the following calendar data.

Response:

Key Data type Value
Id string Unique identifier.
Name string Calendar name.
Description string Description of the calendar.
Metadata object Additional metadata stored for the calendar.

Example:

Boka.calendar.getDisplayableForSystem({
    systemId: 'xxc664',    
    }, function (calendarData) {
        if (calendarData.success){
            console.log(calendarData.result[0].name);
        }
    }
);