BokaMera.API.Host

<back to all web services

UpdateCustomField

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/customfields/{Id}Update a custom fieldCreates a new custom field, if an admin user is making the request, the user will be associated with the admin user's company.
"use strict";
export class CustomFieldLookupResponse {
    /** @param {{Id?:number,Active?:boolean,SortOrder?:number,Value?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {?number} */
    Id;
    /** @type {?boolean} */
    Active;
    /** @type {?number} */
    SortOrder;
    /** @type {string} */
    Value;
}
export class CustomFieldServices {
    /** @param {{Id?:number,Name?:string,ImageUrl?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /**
     * @type {string}
     * @description Name of the service */
    Name;
    /**
     * @type {string}
     * @description The image url of the service */
    ImageUrl;
}
export class CustomFieldQueryResponse {
    /** @param {{Id?:number,CompanyId?:string,GroupId?:number,FieldId?:number,Name?:string,Width?:number,Column?:string,Description?:string,DataType?:string,DefaultValue?:string,IsMandatory?:boolean,MandatoryErrorMessage?:string,MaxLength?:number,MultipleLineText?:boolean,RegEx?:string,RegExId?:number,RegExErrorMessage?:string,IsPublic?:boolean,IsHidden?:boolean,Table?:string,Values?:CustomFieldLookupResponse[],Services?:CustomFieldServices[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @description Custom field id */
    Id;
    /**
     * @type {string}
     * @description Reference to company that owns the custom field configuration */
    CompanyId;
    /**
     * @type {?number}
     * @description Group id */
    GroupId;
    /**
     * @type {number}
     * @description Field id */
    FieldId;
    /**
     * @type {string}
     * @description Configuration name. Example: 'Number of persons'. */
    Name;
    /**
     * @type {number}
     * @description Field width. Example: 20 */
    Width;
    /**
     * @type {string}
     * @description Column in database where to store the information. Example: 'TextField1' */
    Column;
    /**
     * @type {string}
     * @description Custom field description. Example: 'For how many persons is this booking?' */
    Description;
    /**
     * @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 {?number}
     * @description Regular expression id for validation of the field */
    RegExId;
    /**
     * @type {string}
     * @description Error message shown if the regular expression validation failed */
    RegExErrorMessage;
    /**
     * @type {boolean}
     * @description If the field is visible to the customer */
    IsPublic;
    /**
     * @type {boolean}
     * @description If the field should be hidden in lists */
    IsHidden;
    /**
     * @type {string}
     * @description Table to which the field belongs */
    Table;
    /**
     * @type {CustomFieldLookupResponse[]}
     * @description The values to select from if Datatype is DropDown for this custom field */
    Values;
    /**
     * @type {CustomFieldServices[]}
     * @description The services that is connected to the custom field */
    Services;
}
export class CustomFieldGroupValue {
    /** @param {{SortOrder?:number,Value?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {?number} */
    SortOrder;
    /** @type {string} */
    Value;
}
export class UpdateCustomField {
    /** @param {{Id?:number,CompanyId?:string,GroupId?:number,FieldId?:number,Name?:string,Description?:string,IconId?:number,Width?:number,Datatype?:string,DefaultValue?:string,IsMandatory?:boolean,MandatoryErrorMessage?:string,MaxLength?:number,MultipleLineText?:boolean,RegExId?:number,RegExErrorMessage?:string,IsPublic?:boolean,IsHidden?:boolean,Values?:CustomFieldGroupValue[],Services?:CustomFieldServices[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @description Custom field id */
    Id;
    /**
     * @type {?string}
     * @description The company id, if empty will use the company id for the user you are logged in with. */
    CompanyId;
    /**
     * @type {?number}
     * @description Group id */
    GroupId;
    /**
     * @type {number}
     * @description Field id */
    FieldId;
    /**
     * @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 Custom field icon id. Example: '1   House,2   Calendar,3   Building,4   Cart,5   Find,6   Blue flag,7   Green flag,8   Information,9   Lightning,10  Page edit,11  Pencil,12  Link,13  Star,14  User,15  Tick,16  Wrench,17  Clock' */
    IconId;
    /**
     * @type {number}
     * @description Field width. Example: 20 */
    Width;
    /**
     * @type {string}
     * @description Data field of custom field. Valid values are: TextBox, DropDown 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. Default is false */
    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. Default is 500 */
    MaxLength;
    /**
     * @type {?boolean}
     * @description If the field should have multiple lines. Defualt is false */
    MultipleLineText;
    /**
     * @type {?number}
     * @description Regular expression used for validation of the field */
    RegExId;
    /**
     * @type {string}
     * @description Error message shown if the regular expression validation failed */
    RegExErrorMessage;
    /**
     * @type {?boolean}
     * @description If the field is visible to the customer. Default is true */
    IsPublic;
    /**
     * @type {?boolean}
     * @description If the field should be hidden in lists. Default is false */
    IsHidden;
    /**
     * @type {CustomFieldGroupValue[]}
     * @description The values to select from if Datatype is DropDown for this custom field */
    Values;
    /**
     * @type {CustomFieldServices[]}
     * @description The services that is connected to the custom field. If null it will be connected to all services. */
    Services;
}

JavaScript UpdateCustomField 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.

PUT /customfields/{Id} HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"Id":0,"CompanyId":"00000000-0000-0000-0000-000000000000","GroupId":0,"FieldId":0,"Name":"String","Description":"String","IconId":0,"Width":0,"Datatype":"String","DefaultValue":"String","IsMandatory":false,"MandatoryErrorMessage":"String","MaxLength":0,"MultipleLineText":false,"RegExId":0,"RegExErrorMessage":"String","IsPublic":false,"IsHidden":false,"Values":[{"SortOrder":0,"Value":"String"}],"Services":[{"Id":0,"Name":"String"}]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Id":0,"GroupId":0,"FieldId":0,"Name":"String","Width":0,"Column":"String","Description":"String","DataType":"String","DefaultValue":"String","IsMandatory":false,"MandatoryErrorMessage":"String","MaxLength":0,"MultipleLineText":false,"RegEx":"String","RegExId":0,"RegExErrorMessage":"String","IsPublic":false,"IsHidden":false,"Table":"String","Values":[{"Id":0,"Active":false,"SortOrder":0,"Value":"String"}],"Services":[{"Id":0,"Name":"String"}]}