| 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. |
|---|
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| CompanyId | body | Guid? | No | The company id, if empty will use the company id for the user you are logged in with. |
| FieldId | body | int | No | Field id |
| Name | body | string | Yes | Configuration name. Example: 'Number of persons'. |
| Description | body | string | Yes | Custom field description. Example: 'For how many persons is this booking?' |
| IconId | body | int | Yes | 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' |
| Width | body | int | No | Field width. Example: 20 |
| Datatype | body | string | Yes | Data field of custom field. Valid values are: TextBox, DropDown Example: 'TextBox' |
| DefaultValue | body | string | Yes | Default value of the field. Example: '3' |
| IsMandatory | body | bool | No | Determines if the field is required to have a value or not. Default is false |
| MandatoryErrorMessage | body | string | Yes | Error message shown to the user if the field data is required but not entered |
| MaxLength | body | int | Yes | Max lenght of the field. Default is 500 |
| MultipleLineText | body | bool | No | If the field should have multiple lines. Defualt is false |
| RegExId | body | int? | No | Regular expression used for validation of the field |
| RegExErrorMessage | body | string | Yes | Error message shown if the regular expression validation failed |
| IsPublic | body | bool | No | If the field is visible to the customer. Default is true |
| IsHidden | body | bool | No | If the field should be hidden in lists. Default is false |
| Values | body | List<CustomFieldGroupValue> | Yes | The values to select from if Datatype is DropDown for this custom field |
| Services | body | List<CustomFieldServices> | Yes | The services that is connected to the custom field. If null it will be connected to all services. |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| SortOrder | form | short? | No | |
| Value | form | string | Yes |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| Id | form | int | No | |
| Name | form | string | Yes | Name of the service |
| ImageUrl | form | Uri | Yes | The image url of the service |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| Id | form | int | No | Custom field id |
| CompanyId | form | Guid | No | Reference to company that owns the custom field configuration |
| GroupId | form | int? | No | Group id |
| FieldId | form | int | No | Field id |
| Name | form | string | Yes | Configuration name. Example: 'Number of persons'. |
| Width | form | int | No | Field width. Example: 20 |
| Column | form | string | Yes | Column in database where to store the information. Example: 'TextField1' |
| Description | form | string | Yes | Custom field description. Example: 'For how many persons is this booking?' |
| DataType | form | string | Yes | Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' |
| DefaultValue | form | string | Yes | Default value of the field. Example: '3' |
| IsMandatory | form | bool | No | Determines if the field is required to have a value or not |
| MandatoryErrorMessage | form | string | Yes | Error message shown to the user if the field data is required but not entered |
| MaxLength | form | int | No | Max lenght of the field |
| MultipleLineText | form | bool | No | If the field should have multiple lines |
| RegEx | form | string | Yes | Regular expression used for validation of the field |
| RegExId | form | int? | No | Regular expression id for validation of the field |
| RegExErrorMessage | form | string | Yes | Error message shown if the regular expression validation failed |
| IsPublic | form | bool | No | If the field is visible to the customer |
| IsHidden | form | bool | No | If the field should be hidden in lists |
| Table | form | string | Yes | Table to which the field belongs |
| Values | form | List<CustomFieldLookupResponse> | Yes | The values to select from if Datatype is DropDown for this custom field |
| Services | form | List<CustomFieldServices> | Yes | The services that is connected to the custom field |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| Id | form | int? | No | |
| Active | form | bool? | No | |
| SortOrder | form | int? | No | |
| Value | form | string | Yes |
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>