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 java.math.*;
import java.util.*;
import net.servicestack.client.*;

public class dtos
{

    @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 static class UpdateCustomField implements ICompany
    {
        /**
        * Custom field id
        */
        @ApiMember(Description="Custom field id", IsRequired=true, ParameterType="path")
        public Integer Id = null;

        /**
        * 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 UUID CompanyId = null;

        /**
        * Group id
        */
        @ApiMember(Description="Group id")
        public Integer GroupId = null;

        /**
        * Field id
        */
        @ApiMember(Description="Field id")
        public Integer FieldId = null;

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

        /**
        * 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 String Description = null;

        /**
        * 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 Integer IconId = null;

        /**
        * Field width. Example: 20
        */
        @ApiMember(Description="Field width. Example: 20")
        public Integer Width = null;

        /**
        * 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 String Datatype = null;

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

        /**
        * 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 Boolean IsMandatory = null;

        /**
        * 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 String MandatoryErrorMessage = null;

        /**
        * Max lenght of the field. Default is 500
        */
        @ApiMember(Description="Max lenght of the field. Default is 500", IsRequired=true)
        public Integer MaxLength = null;

        /**
        * If the field should have multiple lines. Defualt is false
        */
        @ApiMember(Description="If the field should have multiple lines. Defualt is false")
        public Boolean MultipleLineText = null;

        /**
        * Regular expression used for validation of the field
        */
        @ApiMember(Description="Regular expression used for validation of the field")
        public Integer RegExId = null;

        /**
        * Error message shown if the regular expression validation failed
        */
        @ApiMember(Description="Error message shown if the regular expression validation failed")
        public String RegExErrorMessage = null;

        /**
        * 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 Boolean IsPublic = null;

        /**
        * 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 Boolean IsHidden = null;

        /**
        * 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 ArrayList<CustomFieldGroupValue> Values = null;

        /**
        * 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 ArrayList<CustomFieldServices> Services = null;
        
        public Integer getId() { return Id; }
        public UpdateCustomField setId(Integer value) { this.Id = value; return this; }
        public UUID getCompanyId() { return CompanyId; }
        public UpdateCustomField setCompanyId(UUID value) { this.CompanyId = value; return this; }
        public Integer getGroupId() { return GroupId; }
        public UpdateCustomField setGroupId(Integer value) { this.GroupId = value; return this; }
        public Integer getFieldId() { return FieldId; }
        public UpdateCustomField setFieldId(Integer value) { this.FieldId = value; return this; }
        public String getName() { return Name; }
        public UpdateCustomField setName(String value) { this.Name = value; return this; }
        public String getDescription() { return Description; }
        public UpdateCustomField setDescription(String value) { this.Description = value; return this; }
        public Integer getIconId() { return IconId; }
        public UpdateCustomField setIconId(Integer value) { this.IconId = value; return this; }
        public Integer getWidth() { return Width; }
        public UpdateCustomField setWidth(Integer value) { this.Width = value; return this; }
        public String getDatatype() { return Datatype; }
        public UpdateCustomField setDatatype(String value) { this.Datatype = value; return this; }
        public String getDefaultValue() { return DefaultValue; }
        public UpdateCustomField setDefaultValue(String value) { this.DefaultValue = value; return this; }
        public Boolean getIsMandatory() { return IsMandatory; }
        public UpdateCustomField setIsMandatory(Boolean value) { this.IsMandatory = value; return this; }
        public String getMandatoryErrorMessage() { return MandatoryErrorMessage; }
        public UpdateCustomField setMandatoryErrorMessage(String value) { this.MandatoryErrorMessage = value; return this; }
        public Integer getMaxLength() { return MaxLength; }
        public UpdateCustomField setMaxLength(Integer value) { this.MaxLength = value; return this; }
        public Boolean isMultipleLineText() { return MultipleLineText; }
        public UpdateCustomField setMultipleLineText(Boolean value) { this.MultipleLineText = value; return this; }
        public Integer getRegExId() { return RegExId; }
        public UpdateCustomField setRegExId(Integer value) { this.RegExId = value; return this; }
        public String getRegExErrorMessage() { return RegExErrorMessage; }
        public UpdateCustomField setRegExErrorMessage(String value) { this.RegExErrorMessage = value; return this; }
        public Boolean getIsPublic() { return IsPublic; }
        public UpdateCustomField setIsPublic(Boolean value) { this.IsPublic = value; return this; }
        public Boolean getIsHidden() { return IsHidden; }
        public UpdateCustomField setIsHidden(Boolean value) { this.IsHidden = value; return this; }
        public ArrayList<CustomFieldGroupValue> getValues() { return Values; }
        public UpdateCustomField setValues(ArrayList<CustomFieldGroupValue> value) { this.Values = value; return this; }
        public ArrayList<CustomFieldServices> getServices() { return Services; }
        public UpdateCustomField setServices(ArrayList<CustomFieldServices> value) { this.Services = value; return this; }
    }

    public static class CustomFieldGroupValue
    {
        public Short SortOrder = null;
        public String Value = null;
        
        public Short getSortOrder() { return SortOrder; }
        public CustomFieldGroupValue setSortOrder(Short value) { this.SortOrder = value; return this; }
        public String getValue() { return Value; }
        public CustomFieldGroupValue setValue(String value) { this.Value = value; return this; }
    }

    public static class CustomFieldServices
    {
        public Integer Id = null;
        /**
        * Name of the service
        */
        @ApiMember(Description="Name of the service")
        public String Name = null;

        /**
        * The image url of the service
        */
        @ApiMember(Description="The image url of the service")
        public Uri ImageUrl = null;
        
        public Integer getId() { return Id; }
        public CustomFieldServices setId(Integer value) { this.Id = value; return this; }
        public String getName() { return Name; }
        public CustomFieldServices setName(String value) { this.Name = value; return this; }
        public Uri getImageUrl() { return ImageUrl; }
        public CustomFieldServices setImageUrl(Uri value) { this.ImageUrl = value; return this; }
    }

    public static class CustomFieldQueryResponse
    {
        /**
        * Custom field id
        */
        @ApiMember(Description="Custom field id")
        public Integer Id = null;

        /**
        * Reference to company that owns the custom field configuration
        */
        @ApiMember(Description="Reference to company that owns the custom field configuration")
        public UUID CompanyId = null;

        /**
        * Group id
        */
        @ApiMember(Description="Group id")
        public Integer GroupId = null;

        /**
        * Field id
        */
        @ApiMember(Description="Field id")
        public Integer FieldId = null;

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

        /**
        * Field width. Example: 20
        */
        @ApiMember(Description="Field width. Example: 20")
        public Integer Width = null;

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

        /**
        * 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 String Description = null;

        /**
        * 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 String DataType = null;

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

        /**
        * 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 Boolean IsMandatory = null;

        /**
        * 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 String MandatoryErrorMessage = null;

        /**
        * Max lenght of the field
        */
        @ApiMember(Description="Max lenght of the field")
        public Integer MaxLength = null;

        /**
        * If the field should have multiple lines
        */
        @ApiMember(Description="If the field should have multiple lines")
        public Boolean MultipleLineText = null;

        /**
        * Regular expression used for validation of the field
        */
        @ApiMember(Description="Regular expression used for validation of the field")
        public String RegEx = null;

        /**
        * Regular expression id for validation of the field
        */
        @ApiMember(Description="Regular expression id for validation of the field")
        public Integer RegExId = null;

        /**
        * Error message shown if the regular expression validation failed
        */
        @ApiMember(Description="Error message shown if the regular expression validation failed")
        public String RegExErrorMessage = null;

        /**
        * If the field is visible to the customer
        */
        @ApiMember(Description="If the field is visible to the customer")
        public Boolean IsPublic = null;

        /**
        * If the field should be hidden in lists
        */
        @ApiMember(Description="If the field should be hidden in lists")
        public Boolean IsHidden = null;

        /**
        * Table to which the field belongs
        */
        @ApiMember(Description="Table to which the field belongs")
        public String Table = null;

        /**
        * 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 ArrayList<CustomFieldLookupResponse> Values = null;

        /**
        * The services that is connected to the custom field
        */
        @ApiMember(Description="The services that is connected to the custom field")
        public ArrayList<CustomFieldServices> Services = null;
        
        public Integer getId() { return Id; }
        public CustomFieldQueryResponse setId(Integer value) { this.Id = value; return this; }
        public UUID getCompanyId() { return CompanyId; }
        public CustomFieldQueryResponse setCompanyId(UUID value) { this.CompanyId = value; return this; }
        public Integer getGroupId() { return GroupId; }
        public CustomFieldQueryResponse setGroupId(Integer value) { this.GroupId = value; return this; }
        public Integer getFieldId() { return FieldId; }
        public CustomFieldQueryResponse setFieldId(Integer value) { this.FieldId = value; return this; }
        public String getName() { return Name; }
        public CustomFieldQueryResponse setName(String value) { this.Name = value; return this; }
        public Integer getWidth() { return Width; }
        public CustomFieldQueryResponse setWidth(Integer value) { this.Width = value; return this; }
        public String getColumn() { return Column; }
        public CustomFieldQueryResponse setColumn(String value) { this.Column = value; return this; }
        public String getDescription() { return Description; }
        public CustomFieldQueryResponse setDescription(String value) { this.Description = value; return this; }
        public String getDataType() { return DataType; }
        public CustomFieldQueryResponse setDataType(String value) { this.DataType = value; return this; }
        public String getDefaultValue() { return DefaultValue; }
        public CustomFieldQueryResponse setDefaultValue(String value) { this.DefaultValue = value; return this; }
        public Boolean getIsMandatory() { return IsMandatory; }
        public CustomFieldQueryResponse setIsMandatory(Boolean value) { this.IsMandatory = value; return this; }
        public String getMandatoryErrorMessage() { return MandatoryErrorMessage; }
        public CustomFieldQueryResponse setMandatoryErrorMessage(String value) { this.MandatoryErrorMessage = value; return this; }
        public Integer getMaxLength() { return MaxLength; }
        public CustomFieldQueryResponse setMaxLength(Integer value) { this.MaxLength = value; return this; }
        public Boolean isMultipleLineText() { return MultipleLineText; }
        public CustomFieldQueryResponse setMultipleLineText(Boolean value) { this.MultipleLineText = value; return this; }
        public String getRegEx() { return RegEx; }
        public CustomFieldQueryResponse setRegEx(String value) { this.RegEx = value; return this; }
        public Integer getRegExId() { return RegExId; }
        public CustomFieldQueryResponse setRegExId(Integer value) { this.RegExId = value; return this; }
        public String getRegExErrorMessage() { return RegExErrorMessage; }
        public CustomFieldQueryResponse setRegExErrorMessage(String value) { this.RegExErrorMessage = value; return this; }
        public Boolean getIsPublic() { return IsPublic; }
        public CustomFieldQueryResponse setIsPublic(Boolean value) { this.IsPublic = value; return this; }
        public Boolean getIsHidden() { return IsHidden; }
        public CustomFieldQueryResponse setIsHidden(Boolean value) { this.IsHidden = value; return this; }
        public String getTable() { return Table; }
        public CustomFieldQueryResponse setTable(String value) { this.Table = value; return this; }
        public ArrayList<CustomFieldLookupResponse> getValues() { return Values; }
        public CustomFieldQueryResponse setValues(ArrayList<CustomFieldLookupResponse> value) { this.Values = value; return this; }
        public ArrayList<CustomFieldServices> getServices() { return Services; }
        public CustomFieldQueryResponse setServices(ArrayList<CustomFieldServices> value) { this.Services = value; return this; }
    }

    public static class CustomFieldLookupResponse
    {
        public Integer Id = null;
        public Boolean Active = null;
        public Integer SortOrder = null;
        public String Value = null;
        
        public Integer getId() { return Id; }
        public CustomFieldLookupResponse setId(Integer value) { this.Id = value; return this; }
        public Boolean isActive() { return Active; }
        public CustomFieldLookupResponse setActive(Boolean value) { this.Active = value; return this; }
        public Integer getSortOrder() { return SortOrder; }
        public CustomFieldLookupResponse setSortOrder(Integer value) { this.SortOrder = value; return this; }
        public String getValue() { return Value; }
        public CustomFieldLookupResponse setValue(String value) { this.Value = value; return this; }
    }

}

Java 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
		}
	]
}