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.
namespace BokaMera.API.ServiceModel.Dtos

open System
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations

    [<AllowNullLiteral>]
    type CustomFieldLookupResponse() = 
        member val Id:Nullable<Int32> = new Nullable<Int32>() with get,set
        member val Active:Nullable<Boolean> = new Nullable<Boolean>() with get,set
        member val SortOrder:Nullable<Int32> = new Nullable<Int32>() with get,set
        member val Value:String = null with get,set

    [<AllowNullLiteral>]
    type CustomFieldServices() = 
        member val Id:Int32 = new Int32() with get,set
        ///<summary>
        ///Name of the service
        ///</summary>
        [<ApiMember(Description="Name of the service")>]
        member val Name:String = null with get,set

        ///<summary>
        ///The image url of the service
        ///</summary>
        [<ApiMember(Description="The image url of the service")>]
        member val ImageUrl:Uri = null with get,set

    [<AllowNullLiteral>]
    type CustomFieldQueryResponse() = 
        ///<summary>
        ///Custom field id
        ///</summary>
        [<ApiMember(Description="Custom field id")>]
        member val Id:Int32 = new Int32() with get,set

        ///<summary>
        ///Reference to company that owns the custom field configuration
        ///</summary>
        [<ApiMember(Description="Reference to company that owns the custom field configuration")>]
        member val CompanyId:Guid = new Guid() with get,set

        ///<summary>
        ///Group id
        ///</summary>
        [<ApiMember(Description="Group id")>]
        member val GroupId:Nullable<Int32> = new Nullable<Int32>() with get,set

        ///<summary>
        ///Field id
        ///</summary>
        [<ApiMember(Description="Field id")>]
        member val FieldId:Int32 = new Int32() with get,set

        ///<summary>
        ///Configuration name. Example: 'Number of persons'.
        ///</summary>
        [<ApiMember(Description="Configuration name. Example: 'Number of persons'.")>]
        member val Name:String = null with get,set

        ///<summary>
        ///Field width. Example: 20
        ///</summary>
        [<ApiMember(Description="Field width. Example: 20")>]
        member val Width:Int32 = new Int32() with get,set

        ///<summary>
        ///Column in database where to store the information. Example: 'TextField1'
        ///</summary>
        [<ApiMember(Description="Column in database where to store the information. Example: 'TextField1'")>]
        member val Column:String = null with get,set

        ///<summary>
        ///Custom field description. Example: 'For how many persons is this booking?'
        ///</summary>
        [<ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'")>]
        member val Description:String = null with get,set

        ///<summary>
        ///Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'
        ///</summary>
        [<ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")>]
        member val DataType:String = null with get,set

        ///<summary>
        ///Default value of the field. Example: '3'
        ///</summary>
        [<ApiMember(Description="Default value of the field. Example: '3'")>]
        member val DefaultValue:String = null with get,set

        ///<summary>
        ///Determines if the field is required to have a value or not
        ///</summary>
        [<ApiMember(Description="Determines if the field is required to have a value or not")>]
        member val IsMandatory:Boolean = new Boolean() with get,set

        ///<summary>
        ///Error message shown to the user if the field data is required but not entered
        ///</summary>
        [<ApiMember(Description="Error message shown to the user if the field data is required but not entered")>]
        member val MandatoryErrorMessage:String = null with get,set

        ///<summary>
        ///Max lenght of the field
        ///</summary>
        [<ApiMember(Description="Max lenght of the field")>]
        member val MaxLength:Int32 = new Int32() with get,set

        ///<summary>
        ///If the field should have multiple lines
        ///</summary>
        [<ApiMember(Description="If the field should have multiple lines")>]
        member val MultipleLineText:Boolean = new Boolean() with get,set

        ///<summary>
        ///Regular expression used for validation of the field
        ///</summary>
        [<ApiMember(Description="Regular expression used for validation of the field")>]
        member val RegEx:String = null with get,set

        ///<summary>
        ///Regular expression id for validation of the field
        ///</summary>
        [<ApiMember(Description="Regular expression id for validation of the field")>]
        member val RegExId:Nullable<Int32> = new Nullable<Int32>() with get,set

        ///<summary>
        ///Error message shown if the regular expression validation failed
        ///</summary>
        [<ApiMember(Description="Error message shown if the regular expression validation failed")>]
        member val RegExErrorMessage:String = null with get,set

        ///<summary>
        ///If the field is visible to the customer
        ///</summary>
        [<ApiMember(Description="If the field is visible to the customer")>]
        member val IsPublic:Boolean = new Boolean() with get,set

        ///<summary>
        ///If the field should be hidden in lists
        ///</summary>
        [<ApiMember(Description="If the field should be hidden in lists")>]
        member val IsHidden:Boolean = new Boolean() with get,set

        ///<summary>
        ///Table to which the field belongs
        ///</summary>
        [<ApiMember(Description="Table to which the field belongs")>]
        member val Table:String = null with get,set

        ///<summary>
        ///The values to select from if Datatype is DropDown for this custom field
        ///</summary>
        [<ApiMember(Description="The values to select from if Datatype is DropDown for this custom field")>]
        member val Values:ResizeArray<CustomFieldLookupResponse> = new ResizeArray<CustomFieldLookupResponse>() with get,set

        ///<summary>
        ///The services that is connected to the custom field
        ///</summary>
        [<ApiMember(Description="The services that is connected to the custom field")>]
        member val Services:ResizeArray<CustomFieldServices> = new ResizeArray<CustomFieldServices>() with get,set

    [<AllowNullLiteral>]
    type CustomFieldGroupValue() = 
        member val SortOrder:Nullable<Int16> = new Nullable<Int16>() with get,set
        member val Value:String = null with get,set

    [<ApiResponse(Description="Returned if there is a validation error on the input parameters", StatusCode=400)>]
    [<ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)>]
    [<ValidateRequest(Validator="IsAuthenticated")>]
    [<AllowNullLiteral>]
    type UpdateCustomField() = 
        ///<summary>
        ///Custom field id
        ///</summary>
        [<ApiMember(Description="Custom field id", IsRequired=true, ParameterType="path")>]
        member val Id:Int32 = new Int32() with get,set

        ///<summary>
        ///The company id, if empty will use the company id for the user you are logged in with.
        ///</summary>
        [<ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")>]
        member val CompanyId:Nullable<Guid> = new Nullable<Guid>() with get,set

        ///<summary>
        ///Group id
        ///</summary>
        [<ApiMember(Description="Group id")>]
        member val GroupId:Nullable<Int32> = new Nullable<Int32>() with get,set

        ///<summary>
        ///Field id
        ///</summary>
        [<ApiMember(Description="Field id")>]
        member val FieldId:Int32 = new Int32() with get,set

        ///<summary>
        ///Configuration name. Example: 'Number of persons'.
        ///</summary>
        [<ApiMember(Description="Configuration name. Example: 'Number of persons'.", IsRequired=true)>]
        member val Name:String = null with get,set

        ///<summary>
        ///Custom field description. Example: 'For how many persons is this booking?'
        ///</summary>
        [<ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'", IsRequired=true)>]
        member val Description:String = null with get,set

        ///<summary>
        ///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'
        ///</summary>
        [<ApiMember(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'", IsRequired=true)>]
        member val IconId:Int32 = new Int32() with get,set

        ///<summary>
        ///Field width. Example: 20
        ///</summary>
        [<ApiMember(Description="Field width. Example: 20")>]
        member val Width:Int32 = new Int32() with get,set

        ///<summary>
        ///Data field of custom field. Valid values are: TextBox, DropDown Example: 'TextBox'
        ///</summary>
        [<ApiMember(Description="Data field of custom field. Valid values are: TextBox, DropDown Example: 'TextBox'")>]
        member val Datatype:String = null with get,set

        ///<summary>
        ///Default value of the field. Example: '3'
        ///</summary>
        [<ApiMember(Description="Default value of the field. Example: '3'")>]
        member val DefaultValue:String = null with get,set

        ///<summary>
        ///Determines if the field is required to have a value or not. Default is false
        ///</summary>
        [<ApiMember(Description="Determines if the field is required to have a value or not. Default is false")>]
        member val IsMandatory:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///Error message shown to the user if the field data is required but not entered
        ///</summary>
        [<ApiMember(Description="Error message shown to the user if the field data is required but not entered")>]
        member val MandatoryErrorMessage:String = null with get,set

        ///<summary>
        ///Max lenght of the field. Default is 500
        ///</summary>
        [<ApiMember(Description="Max lenght of the field. Default is 500", IsRequired=true)>]
        member val MaxLength:Int32 = new Int32() with get,set

        ///<summary>
        ///If the field should have multiple lines. Defualt is false
        ///</summary>
        [<ApiMember(Description="If the field should have multiple lines. Defualt is false")>]
        member val MultipleLineText:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///Regular expression used for validation of the field
        ///</summary>
        [<ApiMember(Description="Regular expression used for validation of the field")>]
        member val RegExId:Nullable<Int32> = new Nullable<Int32>() with get,set

        ///<summary>
        ///Error message shown if the regular expression validation failed
        ///</summary>
        [<ApiMember(Description="Error message shown if the regular expression validation failed")>]
        member val RegExErrorMessage:String = null with get,set

        ///<summary>
        ///If the field is visible to the customer. Default is true
        ///</summary>
        [<ApiMember(Description="If the field is visible to the customer. Default is true")>]
        member val IsPublic:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///If the field should be hidden in lists. Default is false
        ///</summary>
        [<ApiMember(Description="If the field should be hidden in lists. Default is false")>]
        member val IsHidden:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///The values to select from if Datatype is DropDown for this custom field
        ///</summary>
        [<ApiMember(Description="The values to select from if Datatype is DropDown for this custom field")>]
        member val Values:ResizeArray<CustomFieldGroupValue> = new ResizeArray<CustomFieldGroupValue>() with get,set

        ///<summary>
        ///The services that is connected to the custom field. If null it will be connected to all services.
        ///</summary>
        [<ApiMember(Description="The services that is connected to the custom field. If null it will be connected to all services.")>]
        member val Services:ResizeArray<CustomFieldServices> = new ResizeArray<CustomFieldServices>() with get,set

F# UpdateCustomField DTOs

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.

PUT /customfields/{Id} HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
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/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
		}
	]
}