BokaMera.API.Host

<back to all web services

CreateCustomField

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/customfieldsCreate 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.
CreateCustomField Parameters:
NameParameterData TypeRequiredDescription
CompanyIdbodyGuid?NoThe company id, if empty will use the company id for the user you are logged in with.
FieldIdbodyintNoField id
NamebodystringYesConfiguration name. Example: 'Number of persons'.
DescriptionbodystringYesCustom field description. Example: 'For how many persons is this booking?'
IconIdbodyintYesCustom 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'
WidthbodyintNoField width. Example: 20
DatatypebodystringYesData field of custom field. Valid values are: TextBox, DropDown Example: 'TextBox'
DefaultValuebodystringYesDefault value of the field. Example: '3'
IsMandatorybodyboolNoDetermines if the field is required to have a value or not. Default is false
MandatoryErrorMessagebodystringYesError message shown to the user if the field data is required but not entered
MaxLengthbodyintYesMax lenght of the field. Default is 500
MultipleLineTextbodyboolNoIf the field should have multiple lines. Defualt is false
RegExIdbodyint?NoRegular expression used for validation of the field
RegExErrorMessagebodystringYesError message shown if the regular expression validation failed
IsPublicbodyboolNoIf the field is visible to the customer. Default is true
IsHiddenbodyboolNoIf the field should be hidden in lists. Default is false
ValuesbodyList<CustomFieldGroupValue>YesThe values to select from if Datatype is DropDown for this custom field
ServicesbodyList<CustomFieldServices>YesThe services that is connected to the custom field. If null it will be connected to all services.
CustomFieldGroupValue Parameters:
NameParameterData TypeRequiredDescription
SortOrderformshort?No
ValueformstringYes
CustomFieldServices Parameters:
NameParameterData TypeRequiredDescription
IdformintNo
NameformstringYesName of the service
ImageUrlformUriYesThe image url of the service
CustomFieldQueryResponse Parameters:
NameParameterData TypeRequiredDescription
IdformintNoCustom field id
CompanyIdformGuidNoReference to company that owns the custom field configuration
GroupIdformint?NoGroup id
FieldIdformintNoField id
NameformstringYesConfiguration name. Example: 'Number of persons'.
WidthformintNoField width. Example: 20
ColumnformstringYesColumn in database where to store the information. Example: 'TextField1'
DescriptionformstringYesCustom field description. Example: 'For how many persons is this booking?'
DataTypeformstringYesData field of custom field. Valid values are: TextBox, ... Example: 'TextBox'
DefaultValueformstringYesDefault value of the field. Example: '3'
IsMandatoryformboolNoDetermines if the field is required to have a value or not
MandatoryErrorMessageformstringYesError message shown to the user if the field data is required but not entered
MaxLengthformintNoMax lenght of the field
MultipleLineTextformboolNoIf the field should have multiple lines
RegExformstringYesRegular expression used for validation of the field
RegExIdformint?NoRegular expression id for validation of the field
RegExErrorMessageformstringYesError message shown if the regular expression validation failed
IsPublicformboolNoIf the field is visible to the customer
IsHiddenformboolNoIf the field should be hidden in lists
TableformstringYesTable to which the field belongs
ValuesformList<CustomFieldLookupResponse>YesThe values to select from if Datatype is DropDown for this custom field
ServicesformList<CustomFieldServices>YesThe services that is connected to the custom field
CustomFieldLookupResponse Parameters:
NameParameterData TypeRequiredDescription
Idformint?No
Activeformbool?No
SortOrderformint?No
ValueformstringYes

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

HTTP + JSV

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

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

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	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/jsv
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
		}
	]
}