Booking system functions

The booking system module handles all functionality regarding booking systems in the Boka Connect SDK. These functions resides in the namespace Boka.bookingsystem and should be prefixed as such.

getAll()

Description:

The getAll() command fetches a list of booking systems for the authenticated user.

URL:

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

Response:

Returns an array of booking system objects.

Usage:

Boka.bookingsystem.getAll(callback);

callback is a function called with a return callback parameter containing an array with the booking system.

Example:

Boka.bookingsystem.getAll(function (bookingSystemData) {
        if (bookingSystemData.success){
            console.log(bookingSystemData.result[0].name);
        }
    }
);

getAdmin()

Description:

The getAdmin() command fetches a list of booking systems where the authenticated user has the admin role.

URL:

[GET] https://api.boka.se/rest/system?role=admin

Response:

Returns an array of booking system objects.

Usage:

Boka.bookingsystem.getAdmin(callback);

callback is a function called with a return callback parameter containing an array with the booking systems.

Example:

Boka.bookingsystem.getAdmin(function (bookingSystemData) {
        if (bookingSystemData.success){
            console.log(bookingSystemData.result[0].name);
        }
    }
);

get() *

Description:

The get() command fetches details about a specific booking system.

Note: A public variant of this command is available.

URL:

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

Public URL:

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

Response:

Returns a booking system object.

Usage:

Boka.bookingsystem.get(params, callback);

params is an object containing the following properties.

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

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

Example:

Boka.bookingsystem.get({
    systemId: 'xxc664',    
    }, function (bookingSystemData) {
        if (bookingSystemData.success){
            console.log(bookingSystemData.result.name);
        }
    }
);

getMerchantId()

Description:

The getMerchantId() command fetches the stored merchant id for a specific system 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>/merchantId

Response:

Returns an integer.

Usage:

Boka.bookingsystem.getMerchantId(params, callback);

params is an object containing the following properties.

Key Value
systemId Unique identifier for the system.
appKey Identifier for the application making the call.

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

Example:

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