Event functions

The event module handles all functionality regarding event calendars in the Boka Connect SDK.

createEventCalendar()

Description:

The createEventCalendar() creates a new calendar in where a booking event is stored. To store an event booking, first create a calendar using this function and use the returned calendar id when persisting bookings.

URL:

[POST] https://api.boka.se/rest/system/eventCalendar
[POST] https://api.boka.se/rest/system/eventCalendar?systemId=<system_id>

Response:

Returns a calendar object.

Usage:

Boka.event.createEventCalendar(params, callback);

params is an object containing the following properties.

Key Value
name The name of the event calendar (usually the same as the event)
[systemId] Unique identifier for the booking system containing the event calendar. If this is omitted, the user's private event system will be used.

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

Example:

Boka.event.createEventCalendar({
    systemId: 'xxc664',
    name: 'Christmas party 2020'
    }, function (calendarData) {
        if (calendarData.success){
            console.log(calendarData.result.Id);
        }
    }
);

getForCalendar()

Description:

The getForCalendar() command fetches the booking event associated with a specific calendar. This is a short-hand version of fetching the first booking in a calendar, as event calendars ususally only holds one booking.

URL:

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

Response:

Returns a booking object.

Usage:

Boka.event.getForCalendar(params, callback);

params is an object containing the following properties.

Key Value
systemId Unique identifier for the booking system containing the article.
calendarId The unqiue identifier of the calendar.

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

Example:

Boka.event.getForCalendar({
    systemId: 'xxc664',
    calendarId: 'yyz112'
    }, function (eventData) {
        if (eventData.success){
            console.log(eventData.result.Start);
        }
    }
);