Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /customfields | Create a custom field | Creates 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 CreateCustomField {
/** @param {{CompanyId?:string,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 {?string}
* @description The company id, if empty will use the company id for the user you are logged in with. */
CompanyId;
/**
* @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 CreateCustomField DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /customfields HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateCustomField xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<Datatype>String</Datatype>
<DefaultValue>String</DefaultValue>
<Description>String</Description>
<FieldId>0</FieldId>
<IconId>0</IconId>
<IsHidden>false</IsHidden>
<IsMandatory>false</IsMandatory>
<IsPublic>false</IsPublic>
<MandatoryErrorMessage>String</MandatoryErrorMessage>
<MaxLength>0</MaxLength>
<MultipleLineText>false</MultipleLineText>
<Name>String</Name>
<RegExErrorMessage>String</RegExErrorMessage>
<RegExId>0</RegExId>
<Services>
<CustomFieldServices>
<Id>0</Id>
<ImageUrl i:nil="true" />
<Name>String</Name>
</CustomFieldServices>
</Services>
<Values>
<CustomFieldGroupValue>
<SortOrder>0</SortOrder>
<Value>String</Value>
</CustomFieldGroupValue>
</Values>
<Width>0</Width>
</CreateCustomField>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CustomFieldQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <Column>String</Column> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <DataType>String</DataType> <DefaultValue>String</DefaultValue> <Description>String</Description> <FieldId>0</FieldId> <GroupId>0</GroupId> <Id>0</Id> <IsHidden>false</IsHidden> <IsMandatory>false</IsMandatory> <IsPublic>false</IsPublic> <MandatoryErrorMessage>String</MandatoryErrorMessage> <MaxLength>0</MaxLength> <MultipleLineText>false</MultipleLineText> <Name>String</Name> <RegEx>String</RegEx> <RegExErrorMessage>String</RegExErrorMessage> <RegExId>0</RegExId> <Services> <CustomFieldServices> <Id>0</Id> <ImageUrl i:nil="true" /> <Name>String</Name> </CustomFieldServices> </Services> <Table>String</Table> <Values> <CustomFieldLookupResponse> <Active>false</Active> <Id>0</Id> <SortOrder>0</SortOrder> <Value>String</Value> </CustomFieldLookupResponse> </Values> <Width>0</Width> </CustomFieldQueryResponse>