Customer record functions

The customer record module handles all functionality regarding customers in the Boka Connect SDK.

createCustomer() *

Description:

The createCustomer() command creates a customer for the given booking system.

URL:

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

Public URL:

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

Response:

Returns a customer object when calling the regular function. But when calling the public function, the response will merely be an object with the id of the customer.

Usage:

Boka.customerrecord.createCustomer(params, callback);

params is an object containing the following properties.

Key Value
[systemId] Unique identifier for the booking system containing the customer.
[name] Customer name.
[email] Customer email.
[address] Customer address.
[city] City where the customer is located.
[zipCode] Customer zip code.
[mobile] Customer mobile.
[comment] Internal comments made by administrators that can, for example, describe the customer.
[asPublic] Boolean indicating whether the public version of the function should be used. (Default false)

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

Example:

Boka.customerrecord.createCustomer({
    systemId: 'xxc664',
    name: 'John Doe',
    email: 'john@doe',
    address: 'Street 123',
    city: 'Stockholm',
    zipCode: '123 45',
    mobile: '0701234567',
    comment: 'Nice guy!',
    }, function (customerData) {
        if (customerData.success){
            console.log(customerData.result);
        }
    }
);

customerSearch()

Description:

The customerSearch() searches for a customer based on name and email, and returns customers that fit the critera.

URL:

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

NOTE! Remember to URL encode the query to account for any special characters.

Response:

Returns an array of customer objects.

Usage:

Boka.customerrecord.customerSearch(params, callback);

params is an object containing the following properties.

Key Value
[systemId] Unique identifier for the booking system containing the equipment calendars.
[query] The search term which is matched against name and email. NOTE! Has to be atleast 3 characters.

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

Example:

Boka.event.createEquipmentBooking({
    systemId: 'xxc664',
    query: 'John',
    function (customerData) {
        if (data.success) 
            console.log(customerData.result.customers);
    }
);