Equipment functions

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

createEquipmentSystem()

Description:

The createEquipmentSystem() command creates an equipment system.

URL:

[POST] https://api.boka.se/rest/system/equipmentSystem

Response:

Returns the id of the created equipment system.

Usage:

Boka.equipment.createEquipmentSystem(callback);

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

Example:

Boka.equipment.createEquipmentSystem(
    function (data) {
        if (data.success){
            console.log(data.result.SystemId);
        }
    }
);

getEquipmentSystems()

Description:

The getEquipmentSystems() command fetches a list of equipment systems for the authenticated user.

URL:

[GET] https://api.boka.se/rest/system/equipmentSystems

Response:

Returns an array of booking system objects.

Usage:

Boka.equipment.getEquipmentSystems(callback);

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

Example:

Boka.equipment.getEquipmentSystems(
    function (data) {
        if (data.success){
            console.log(data.result[0].name);
        }
    }
);

createEquipmentCalendars()

Description:

The createEquipmentCalendars() command creates a number of calendars based on the count parameter.

URL:

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

Response:

Returns a string of calendar ids, a stringified array of identifiers.

Usage:

Boka.equipment.createEquipmentCalendars(params, callback);

params is an object containing the following properties.

Key Value
[systemId] Unique identifier for the booking system containing the equipment calendar. If this is omitted, a new equipment system will be created.
[count] The number of calendars that will be created.

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

Example:

Boka.equipment.createEquipmentCalendars({
    systemId: 'xxc664',
    count: '20'
    }, function (data) {
        if (data.success){
            console.log(data.result.CalendarIds);
        }
    }
);

Note! If your using the api call, 'count' has to be in a property called 'metadata'.

createEquipmentBooking()

Description:

The createEquipmentBooking() command creates a booking for all of the calendar ids provided.

URL:

[POST] https://api.boka.se/rest/system/<system_id>/createEquipmentBooking

Response:

Returns a string of booking ids, a stringified array of identifiers.

Usage:

Boka.event.createEquipmentBooking(params, callback);

params is an object containing the following properties.

Key Value
[systemId] Unique identifier for the booking system containing the equipment calendars.
[calendarIds] Identifiers for the all the calendars where the booking should be created.
[subject] Booking subject.
[start] Timestamp for booking start in ISO 8601 format.
[end] Timestamp for booking end in ISO 8601 format.
[name] Booker name.
[email] Booker email.
[metadata] Additional metadata stored for the booking.

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

Example:

Boka.equipment.createEquipmentBooking({
    systemId: 'xxc664',
    calendarIds: ['yyz112','aabbcc'],    
    subject: 'Party',
    start: '2017-12-31 18:00',
    end: '2018-01-01 03:00',    
    name: 'John doe',
    email: 'john@doe.com'      
    }, function (data) {
        if (data.success) 
            console.log(data.result.BookingIds);
    }
);