Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
PUT | /customfields/{Id} | Update 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. |
---|
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
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.
PUT /customfields/{Id} HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UpdateCustomField 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>
<GroupId>0</GroupId>
<IconId>0</IconId>
<Id>0</Id>
<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>
</UpdateCustomField>
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>