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. |
---|
import java.math.*
import java.util.*
import net.servicestack.client.*
@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")
open class UpdateCustomField : ICompany
{
/**
* Custom field id
*/
@ApiMember(Description="Custom field id", IsRequired=true, ParameterType="path")
var Id:Int? = 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.")
var CompanyId:UUID? = null
/**
* Group id
*/
@ApiMember(Description="Group id")
var GroupId:Int? = null
/**
* Field id
*/
@ApiMember(Description="Field id")
var FieldId:Int? = null
/**
* Configuration name. Example: 'Number of persons'.
*/
@ApiMember(Description="Configuration name. Example: 'Number of persons'.", IsRequired=true)
var Name:String? = 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)
var Description:String? = 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)
var IconId:Int? = null
/**
* Field width. Example: 20
*/
@ApiMember(Description="Field width. Example: 20")
var Width:Int? = 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'")
var Datatype:String? = null
/**
* Default value of the field. Example: '3'
*/
@ApiMember(Description="Default value of the field. Example: '3'")
var DefaultValue:String? = 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")
var IsMandatory:Boolean? = 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")
var MandatoryErrorMessage:String? = null
/**
* Max lenght of the field. Default is 500
*/
@ApiMember(Description="Max lenght of the field. Default is 500", IsRequired=true)
var MaxLength:Int? = null
/**
* If the field should have multiple lines. Defualt is false
*/
@ApiMember(Description="If the field should have multiple lines. Defualt is false")
var MultipleLineText:Boolean? = null
/**
* Regular expression used for validation of the field
*/
@ApiMember(Description="Regular expression used for validation of the field")
var RegExId:Int? = null
/**
* Error message shown if the regular expression validation failed
*/
@ApiMember(Description="Error message shown if the regular expression validation failed")
var RegExErrorMessage:String? = 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")
var IsPublic:Boolean? = 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")
var IsHidden:Boolean? = 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")
var Values:ArrayList<CustomFieldGroupValue> = ArrayList<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.")
var Services:ArrayList<CustomFieldServices> = ArrayList<CustomFieldServices>()
}
open class CustomFieldGroupValue
{
var SortOrder:Short? = null
var Value:String? = null
}
open class CustomFieldServices
{
var Id:Int? = null
/**
* Name of the service
*/
@ApiMember(Description="Name of the service")
var Name:String? = null
/**
* The image url of the service
*/
@ApiMember(Description="The image url of the service")
var ImageUrl:Uri? = null
}
open class CustomFieldQueryResponse
{
/**
* Custom field id
*/
@ApiMember(Description="Custom field id")
var Id:Int? = null
/**
* Reference to company that owns the custom field configuration
*/
@ApiMember(Description="Reference to company that owns the custom field configuration")
var CompanyId:UUID? = null
/**
* Group id
*/
@ApiMember(Description="Group id")
var GroupId:Int? = null
/**
* Field id
*/
@ApiMember(Description="Field id")
var FieldId:Int? = null
/**
* Configuration name. Example: 'Number of persons'.
*/
@ApiMember(Description="Configuration name. Example: 'Number of persons'.")
var Name:String? = null
/**
* Field width. Example: 20
*/
@ApiMember(Description="Field width. Example: 20")
var Width:Int? = null
/**
* Column in database where to store the information. Example: 'TextField1'
*/
@ApiMember(Description="Column in database where to store the information. Example: 'TextField1'")
var Column:String? = 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?'")
var Description:String? = 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'")
var DataType:String? = null
/**
* Default value of the field. Example: '3'
*/
@ApiMember(Description="Default value of the field. Example: '3'")
var DefaultValue:String? = 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")
var IsMandatory:Boolean? = 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")
var MandatoryErrorMessage:String? = null
/**
* Max lenght of the field
*/
@ApiMember(Description="Max lenght of the field")
var MaxLength:Int? = null
/**
* If the field should have multiple lines
*/
@ApiMember(Description="If the field should have multiple lines")
var MultipleLineText:Boolean? = null
/**
* Regular expression used for validation of the field
*/
@ApiMember(Description="Regular expression used for validation of the field")
var RegEx:String? = null
/**
* Regular expression id for validation of the field
*/
@ApiMember(Description="Regular expression id for validation of the field")
var RegExId:Int? = null
/**
* Error message shown if the regular expression validation failed
*/
@ApiMember(Description="Error message shown if the regular expression validation failed")
var RegExErrorMessage:String? = null
/**
* If the field is visible to the customer
*/
@ApiMember(Description="If the field is visible to the customer")
var IsPublic:Boolean? = null
/**
* If the field should be hidden in lists
*/
@ApiMember(Description="If the field should be hidden in lists")
var IsHidden:Boolean? = null
/**
* Table to which the field belongs
*/
@ApiMember(Description="Table to which the field belongs")
var Table:String? = 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")
var Values:ArrayList<CustomFieldLookupResponse> = ArrayList<CustomFieldLookupResponse>()
/**
* The services that is connected to the custom field
*/
@ApiMember(Description="The services that is connected to the custom field")
var Services:ArrayList<CustomFieldServices> = ArrayList<CustomFieldServices>()
}
open class CustomFieldLookupResponse
{
var Id:Int? = null
var Active:Boolean? = null
var SortOrder:Int? = null
var Value:String? = null
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
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/json
Content-Type: application/json
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: application/json 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"}]}