BokaMera.API.Host

<back to all web services

CreateCustomer

Requires Authentication
Required role:bookingsupplier-administrator-write
The following routes are available for this service:
POST/customersCreate a new customerCreates a new customer, if an admin user is making the request, the user will be associated with the admin user's company.
"use strict";
export class CustomFieldValueResponse {
    /** @param {{Value?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    Value;
}
export class CustomFieldConfigData {
    /** @param {{Id?:number,Name?:string,Description?:string,Width?:number,DataType?:string,DefaultValue?:string,IsMandatory?:boolean,MandatoryErrorMessage?:string,MaxLength?:number,MultipleLineText?:boolean,RegEx?:string,RegExErrorMessage?:string,Values?:CustomFieldValueResponse[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @description Custom field id */
    Id;
    /**
     * @type {string}
     * @description Configuration name. Example: 'Number of persons'. */
    Name;
    /**
     * @type {string}
     * @description Custom field description. Example: 'For how many persons is this booking?' */
    Description;
    /**
     * @type {?number}
     * @description Field width. Example: 20 for 20px */
    Width;
    /**
     * @type {string}
     * @description Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' */
    DataType;
    /**
     * @type {string}
     * @description Default value of the field. Example: '3' */
    DefaultValue;
    /**
     * @type {boolean}
     * @description Determines if the field is required to have a value or not */
    IsMandatory;
    /**
     * @type {string}
     * @description Error message shown to the user if the field data is required but not entered */
    MandatoryErrorMessage;
    /**
     * @type {number}
     * @description Max lenght of the field */
    MaxLength;
    /**
     * @type {boolean}
     * @description If the field should have multiple lines */
    MultipleLineText;
    /**
     * @type {string}
     * @description Regular expression used for validation of the field */
    RegEx;
    /**
     * @type {string}
     * @description Error message shown if the regular expression validation failed */
    RegExErrorMessage;
    /**
     * @type {CustomFieldValueResponse[]}
     * @description The values to select from if Datatype is DropDown for this custom field */
    Values;
}
export class CustomFieldDataResponse {
    /** @param {{Id?:number,Column?:string,Name?:string,Description?:string,Value?:string,DataType?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /** @type {string} */
    Column;
    /** @type {string} */
    Name;
    /** @type {string} */
    Description;
    /** @type {string} */
    Value;
    /**
     * @type {string}
     * @description Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' */
    DataType;
}
export class CustomerCommentsResponse {
    /** @param {{Id?:number,CustomerId?:string,Comments?:string,Updated?:string,Created?:string,ImageUrl?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /** @type {string} */
    CustomerId;
    /** @type {string} */
    Comments;
    /** @type {string} */
    Updated;
    /** @type {string} */
    Created;
    /** @type {string} */
    ImageUrl;
}
export class BaseModel {
    constructor(init) { Object.assign(this, init) }
}
export class UserAccessKeys extends BaseModel {
    /** @param {{CompanyId?:string,AccessKeyTypeId?:number,Value?:string,CustomerId?:string,Description?:string,Id?:string}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {string} */
    CompanyId;
    /** @type {number} */
    AccessKeyTypeId;
    /** @type {string} */
    Value;
    /** @type {string} */
    CustomerId;
    /** @type {string} */
    Description;
    /** @type {string} */
    Id;
}
export class InvoiceAddress {
    /** @param {{CorporateIdentityNumber?:string,InvoiceAddress1?:string,InvoiceAddress2?:string,InvoiceCity?:string,InvoicePostalCode?:string,InvoiceCountryCode?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    CorporateIdentityNumber;
    /** @type {string} */
    InvoiceAddress1;
    /** @type {string} */
    InvoiceAddress2;
    /** @type {string} */
    InvoiceCity;
    /** @type {string} */
    InvoicePostalCode;
    /** @type {string} */
    InvoiceCountryCode;
}
export class CustomerQueryResponse {
    /** @param {{Id?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string,ImageUrl?:string,CustomFields?:CustomFieldConfigData[],CustomFieldValues?:CustomFieldDataResponse[],Comments?:CustomerCommentsResponse[],AccessKeys?:UserAccessKeys[],Updated?:string,Created?:string,ResponseStatus?:Object,SubscribedToNewsletter?:boolean,InvoiceAddress?:InvoiceAddress}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    Id;
    /** @type {string} */
    Firstname;
    /** @type {string} */
    Lastname;
    /** @type {string} */
    Email;
    /** @type {string} */
    Phone;
    /** @type {string} */
    ImageUrl;
    /** @type {CustomFieldConfigData[]} */
    CustomFields;
    /** @type {CustomFieldDataResponse[]} */
    CustomFieldValues;
    /** @type {CustomerCommentsResponse[]} */
    Comments;
    /** @type {UserAccessKeys[]} */
    AccessKeys;
    /** @type {string} */
    Updated;
    /** @type {string} */
    Created;
    /** @type {Object} */
    ResponseStatus;
    /** @type {boolean} */
    SubscribedToNewsletter;
    /** @type {InvoiceAddress} */
    InvoiceAddress;
}
export class UpdateCustomerResponse extends CustomerQueryResponse {
    /** @param {{FacebookUserName?:string,UserId?:string,CompanyId?:string,CreatedDate?:string,DeletedAccessKeys?:UserAccessKeys[],CreatedOrUpdatedAccessKeys?:UserAccessKeys[],Id?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string,ImageUrl?:string,CustomFields?:CustomFieldConfigData[],CustomFieldValues?:CustomFieldDataResponse[],Comments?:CustomerCommentsResponse[],AccessKeys?:UserAccessKeys[],Updated?:string,Created?:string,ResponseStatus?:Object,SubscribedToNewsletter?:boolean,InvoiceAddress?:InvoiceAddress}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {string} */
    FacebookUserName;
    /** @type {?string} */
    UserId;
    /** @type {?string} */
    CompanyId;
    /** @type {?string} */
    CreatedDate;
    /** @type {UserAccessKeys[]} */
    DeletedAccessKeys;
    /** @type {UserAccessKeys[]} */
    CreatedOrUpdatedAccessKeys;
}
export class AddCustomField {
    /** @param {{Id?:number,Value?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /** @type {string} */
    Value;
}
export class AddUserAccessKey {
    /** @param {{Id?:string,CompanyId?:string,AccessKeyTypeId?:number,Value?:string,CustomerId?:string,Description?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {?string} */
    Id;
    /** @type {?string} */
    CompanyId;
    /** @type {number} */
    AccessKeyTypeId;
    /** @type {string} */
    Value;
    /** @type {?string} */
    CustomerId;
    /** @type {string} */
    Description;
}
export class CreateCustomer {
    /** @param {{CompanyId?:string,Firstname?:string,Lastname?:string,Phone?:string,Email?:string,CustomFields?:AddCustomField[],AccessKeys?:AddUserAccessKey[],InvoiceAddress?:InvoiceAddress}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {?string}
     * @description Enter the company and id for the customer, if blank company id and you are an admin, your company id will be used. */
    CompanyId;
    /** @type {string} */
    Firstname;
    /** @type {string} */
    Lastname;
    /** @type {string} */
    Phone;
    /** @type {string} */
    Email;
    /**
     * @type {AddCustomField[]}
     * @description If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated */
    CustomFields;
    /**
     * @type {AddUserAccessKey[]}
     * @description List of Access Keys */
    AccessKeys;
    /**
     * @type {InvoiceAddress}
     * @description Customer invoice adress */
    InvoiceAddress;
}

JavaScript CreateCustomer DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /customers HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Firstname":"String","Lastname":"String","Phone":"String","Email":"String","CustomFields":[{"Id":0,"Value":"String"}],"AccessKeys":[{"Id":"00000000-0000-0000-0000-000000000000","CompanyId":"00000000-0000-0000-0000-000000000000","AccessKeyTypeId":0,"Value":"String","CustomerId":"00000000-0000-0000-0000-000000000000","Description":"String"}],"InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"}}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"FacebookUserName":"String","UserId":"00000000-0000-0000-0000-000000000000","CompanyId":"00000000-0000-0000-0000-000000000000","CreatedDate":"0001-01-01T00:00:00","DeletedAccessKeys":[{"AccessKeyTypeId":0,"Value":"String","Description":"String"}],"CreatedOrUpdatedAccessKeys":[{"AccessKeyTypeId":0,"Value":"String","Description":"String"}],"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","ImageUrl":"String","CustomFields":[{"Id":0,"Name":"String","Description":"String","Width":0,"DataType":"String","DefaultValue":"String","IsMandatory":false,"MandatoryErrorMessage":"String","MaxLength":0,"MultipleLineText":false,"RegEx":"String","RegExErrorMessage":"String","Values":[{"Value":"String"}]}],"CustomFieldValues":[{"Id":0,"Column":"String","Name":"String","Description":"String","Value":"String","DataType":"String"}],"Comments":[{"Id":0,"Comments":"String"}],"AccessKeys":[{"AccessKeyTypeId":0,"Value":"String","Description":"String"}],"ResponseStatus":{},"SubscribedToNewsletter":false,"InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"}}