User group functions

The user group module handles all functionality regarding user groups in the Boka Connect SDK. A user group is a subset of Boka users connected to an existing booking system in Boka. These functions resides in the namespace Boka.usergroups and should be prefixed as such.

get()

Description:

The get() command fetches a list of users for a specified user group.

URL:

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

Response:

Returns a user group object.

Usage:

Boka.usergroups.get(params, callback);

params is an object containing the following properties.

Key Value
systemId Unique identifier for the booking system where the user group resides.
groupId Unique identifer for the user group.

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

Example:

Boka.usergroups.get({
    systemId: 'xxc664',
    groupId: 'bbv554'
    }, function (userGroupData) {
        if (userGroupData.success){
            console.log(userGroupData.result.Users[0].Name);
        }
    }
);

getForSystem()

Description:

The getForSystem() command fetches a list of user groups for a specified booking system.

URL:

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

Response:

Returns an array of user group objects.

Usage:

Boka.usergroups.getForSystem(params, callback);

params is an object containing the following properties.

Key Value
systemId Unique identifier for the booking system where the user groups reside.

callback is a function called with a return callback parameter containing an array with user group data.

Example:

Boka.usergroups.getForSystem({
    systemId: 'xxc664',    
    }, function (userGroupData) {
        if (userGroupData.success){
            console.log(userGroupData.result[0].Name);
        }
    }
);