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.
import Foundation
import ServiceStack

// @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")
public class UpdateCustomField : ICompany, Codable
{
    /**
    * Custom field id
    */
    // @ApiMember(Description="Custom field id", IsRequired=true, ParameterType="path")
    public var id:Int

    /**
    * The company id, if empty will use the company id for the user you are logged in with.
    */
    // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
    public var companyId:String?

    /**
    * Group id
    */
    // @ApiMember(Description="Group id")
    public var groupId:Int?

    /**
    * Field id
    */
    // @ApiMember(Description="Field id")
    public var fieldId:Int

    /**
    * Configuration name. Example: 'Number of persons'.
    */
    // @ApiMember(Description="Configuration name. Example: 'Number of persons'.", IsRequired=true)
    public var name:String

    /**
    * Custom field description. Example: 'For how many persons is this booking?'
    */
    // @ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'", IsRequired=true)
    public var Description:String

    /**
    * 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'
    */
    // @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)
    public var iconId:Int

    /**
    * Field width. Example: 20
    */
    // @ApiMember(Description="Field width. Example: 20")
    public var width:Int

    /**
    * Data field of custom field. Valid values are: TextBox, DropDown Example: 'TextBox'
    */
    // @ApiMember(Description="Data field of custom field. Valid values are: TextBox, DropDown Example: 'TextBox'")
    public var datatype:String

    /**
    * Default value of the field. Example: '3'
    */
    // @ApiMember(Description="Default value of the field. Example: '3'")
    public var defaultValue:String

    /**
    * Determines if the field is required to have a value or not. Default is false
    */
    // @ApiMember(Description="Determines if the field is required to have a value or not. Default is false")
    public var isMandatory:Bool?

    /**
    * Error message shown to the user if the field data is required but not entered
    */
    // @ApiMember(Description="Error message shown to the user if the field data is required but not entered")
    public var mandatoryErrorMessage:String

    /**
    * Max lenght of the field. Default is 500
    */
    // @ApiMember(Description="Max lenght of the field. Default is 500", IsRequired=true)
    public var maxLength:Int

    /**
    * If the field should have multiple lines. Defualt is false
    */
    // @ApiMember(Description="If the field should have multiple lines. Defualt is false")
    public var multipleLineText:Bool?

    /**
    * Regular expression used for validation of the field
    */
    // @ApiMember(Description="Regular expression used for validation of the field")
    public var regExId:Int?

    /**
    * Error message shown if the regular expression validation failed
    */
    // @ApiMember(Description="Error message shown if the regular expression validation failed")
    public var regExErrorMessage:String

    /**
    * If the field is visible to the customer. Default is true
    */
    // @ApiMember(Description="If the field is visible to the customer. Default is true")
    public var isPublic:Bool?

    /**
    * If the field should be hidden in lists. Default is false
    */
    // @ApiMember(Description="If the field should be hidden in lists. Default is false")
    public var isHidden:Bool?

    /**
    * The values to select from if Datatype is DropDown for this custom field
    */
    // @ApiMember(Description="The values to select from if Datatype is DropDown for this custom field")
    public var values:[CustomFieldGroupValue] = []

    /**
    * The services that is connected to the custom field. If null it will be connected to all services.
    */
    // @ApiMember(Description="The services that is connected to the custom field. If null it will be connected to all services.")
    public var services:[CustomFieldServices] = []

    required public init(){}
}

public class CustomFieldGroupValue : Codable
{
    public var sortOrder:Int16?
    public var value:String

    required public init(){}
}

public class CustomFieldServices : Codable
{
    public var id:Int
    /**
    * Name of the service
    */
    // @ApiMember(Description="Name of the service")
    public var name:String

    /**
    * The image url of the service
    */
    // @ApiMember(Description="The image url of the service")
    public var imageUrl:Uri

    required public init(){}
}

public class CustomFieldQueryResponse : Codable
{
    /**
    * Custom field id
    */
    // @ApiMember(Description="Custom field id")
    public var id:Int

    /**
    * Reference to company that owns the custom field configuration
    */
    // @ApiMember(Description="Reference to company that owns the custom field configuration")
    public var companyId:String

    /**
    * Group id
    */
    // @ApiMember(Description="Group id")
    public var groupId:Int?

    /**
    * Field id
    */
    // @ApiMember(Description="Field id")
    public var fieldId:Int

    /**
    * Configuration name. Example: 'Number of persons'.
    */
    // @ApiMember(Description="Configuration name. Example: 'Number of persons'.")
    public var name:String

    /**
    * Field width. Example: 20
    */
    // @ApiMember(Description="Field width. Example: 20")
    public var width:Int

    /**
    * Column in database where to store the information. Example: 'TextField1'
    */
    // @ApiMember(Description="Column in database where to store the information. Example: 'TextField1'")
    public var column:String

    /**
    * Custom field description. Example: 'For how many persons is this booking?'
    */
    // @ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'")
    public var Description:String

    /**
    * Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'
    */
    // @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")
    public var dataType:String

    /**
    * Default value of the field. Example: '3'
    */
    // @ApiMember(Description="Default value of the field. Example: '3'")
    public var defaultValue:String

    /**
    * Determines if the field is required to have a value or not
    */
    // @ApiMember(Description="Determines if the field is required to have a value or not")
    public var isMandatory:Bool

    /**
    * Error message shown to the user if the field data is required but not entered
    */
    // @ApiMember(Description="Error message shown to the user if the field data is required but not entered")
    public var mandatoryErrorMessage:String

    /**
    * Max lenght of the field
    */
    // @ApiMember(Description="Max lenght of the field")
    public var maxLength:Int

    /**
    * If the field should have multiple lines
    */
    // @ApiMember(Description="If the field should have multiple lines")
    public var multipleLineText:Bool

    /**
    * Regular expression used for validation of the field
    */
    // @ApiMember(Description="Regular expression used for validation of the field")
    public var regEx:String

    /**
    * Regular expression id for validation of the field
    */
    // @ApiMember(Description="Regular expression id for validation of the field")
    public var regExId:Int?

    /**
    * Error message shown if the regular expression validation failed
    */
    // @ApiMember(Description="Error message shown if the regular expression validation failed")
    public var regExErrorMessage:String

    /**
    * If the field is visible to the customer
    */
    // @ApiMember(Description="If the field is visible to the customer")
    public var isPublic:Bool

    /**
    * If the field should be hidden in lists
    */
    // @ApiMember(Description="If the field should be hidden in lists")
    public var isHidden:Bool

    /**
    * Table to which the field belongs
    */
    // @ApiMember(Description="Table to which the field belongs")
    public var table:String

    /**
    * The values to select from if Datatype is DropDown for this custom field
    */
    // @ApiMember(Description="The values to select from if Datatype is DropDown for this custom field")
    public var values:[CustomFieldLookupResponse] = []

    /**
    * The services that is connected to the custom field
    */
    // @ApiMember(Description="The services that is connected to the custom field")
    public var services:[CustomFieldServices] = []

    required public init(){}
}

public class CustomFieldLookupResponse : Codable
{
    public var id:Int?
    public var active:Bool?
    public var sortOrder:Int?
    public var value:String

    required public init(){}
}


Swift UpdateCustomField DTOs

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

HTTP + 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>