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. |
---|
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports BokaMera.API.ServiceModel.Dtos
Namespace Global
Namespace BokaMera.API.ServiceModel.Dtos
Public Partial Class CustomFieldGroupValue
Public Overridable Property SortOrder As Nullable(Of Short)
Public Overridable Property Value As String
End Class
Public Partial Class CustomFieldLookupResponse
Public Overridable Property Id As Nullable(Of Integer)
Public Overridable Property Active As Nullable(Of Boolean)
Public Overridable Property SortOrder As Nullable(Of Integer)
Public Overridable Property Value As String
End Class
Public Partial Class CustomFieldQueryResponse
Public Sub New()
Values = New List(Of CustomFieldLookupResponse)
Services = New List(Of CustomFieldServices)
End Sub
'''<Summary>
'''Custom field id
'''</Summary>
<ApiMember(Description:="Custom field id")>
Public Overridable Property Id As Integer
'''<Summary>
'''Reference to company that owns the custom field configuration
'''</Summary>
<ApiMember(Description:="Reference to company that owns the custom field configuration")>
Public Overridable Property CompanyId As Guid
'''<Summary>
'''Group id
'''</Summary>
<ApiMember(Description:="Group id")>
Public Overridable Property GroupId As Nullable(Of Integer)
'''<Summary>
'''Field id
'''</Summary>
<ApiMember(Description:="Field id")>
Public Overridable Property FieldId As Integer
'''<Summary>
'''Configuration name. Example: 'Number of persons'.
'''</Summary>
<ApiMember(Description:="Configuration name. Example: 'Number of persons'.")>
Public Overridable Property Name As String
'''<Summary>
'''Field width. Example: 20
'''</Summary>
<ApiMember(Description:="Field width. Example: 20")>
Public Overridable Property Width As Integer
'''<Summary>
'''Column in database where to store the information. Example: 'TextField1'
'''</Summary>
<ApiMember(Description:="Column in database where to store the information. Example: 'TextField1'")>
Public Overridable Property Column As String
'''<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?'")>
Public Overridable Property Description As String
'''<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'")>
Public Overridable Property DataType As String
'''<Summary>
'''Default value of the field. Example: '3'
'''</Summary>
<ApiMember(Description:="Default value of the field. Example: '3'")>
Public Overridable Property DefaultValue As String
'''<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")>
Public Overridable Property IsMandatory As Boolean
'''<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")>
Public Overridable Property MandatoryErrorMessage As String
'''<Summary>
'''Max lenght of the field
'''</Summary>
<ApiMember(Description:="Max lenght of the field")>
Public Overridable Property MaxLength As Integer
'''<Summary>
'''If the field should have multiple lines
'''</Summary>
<ApiMember(Description:="If the field should have multiple lines")>
Public Overridable Property MultipleLineText As Boolean
'''<Summary>
'''Regular expression used for validation of the field
'''</Summary>
<ApiMember(Description:="Regular expression used for validation of the field")>
Public Overridable Property RegEx As String
'''<Summary>
'''Regular expression id for validation of the field
'''</Summary>
<ApiMember(Description:="Regular expression id for validation of the field")>
Public Overridable Property RegExId As Nullable(Of Integer)
'''<Summary>
'''Error message shown if the regular expression validation failed
'''</Summary>
<ApiMember(Description:="Error message shown if the regular expression validation failed")>
Public Overridable Property RegExErrorMessage As String
'''<Summary>
'''If the field is visible to the customer
'''</Summary>
<ApiMember(Description:="If the field is visible to the customer")>
Public Overridable Property IsPublic As Boolean
'''<Summary>
'''If the field should be hidden in lists
'''</Summary>
<ApiMember(Description:="If the field should be hidden in lists")>
Public Overridable Property IsHidden As Boolean
'''<Summary>
'''Table to which the field belongs
'''</Summary>
<ApiMember(Description:="Table to which the field belongs")>
Public Overridable Property Table As String
'''<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")>
Public Overridable Property Values As List(Of CustomFieldLookupResponse)
'''<Summary>
'''The services that is connected to the custom field
'''</Summary>
<ApiMember(Description:="The services that is connected to the custom field")>
Public Overridable Property Services As List(Of CustomFieldServices)
End Class
Public Partial Class CustomFieldServices
Public Overridable Property Id As Integer
'''<Summary>
'''Name of the service
'''</Summary>
<ApiMember(Description:="Name of the service")>
Public Overridable Property Name As String
'''<Summary>
'''The image url of the service
'''</Summary>
<ApiMember(Description:="The image url of the service")>
Public Overridable Property ImageUrl As Uri
End Class
<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 Partial Class UpdateCustomField
Implements ICompany
Public Sub New()
Values = New List(Of CustomFieldGroupValue)
Services = New List(Of CustomFieldServices)
End Sub
'''<Summary>
'''Custom field id
'''</Summary>
<ApiMember(Description:="Custom field id", IsRequired:=true, ParameterType:="path")>
Public Overridable Property Id As Integer
'''<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.")>
Public Overridable Property CompanyId As Nullable(Of Guid)
'''<Summary>
'''Group id
'''</Summary>
<ApiMember(Description:="Group id")>
Public Overridable Property GroupId As Nullable(Of Integer)
'''<Summary>
'''Field id
'''</Summary>
<ApiMember(Description:="Field id")>
Public Overridable Property FieldId As Integer
'''<Summary>
'''Configuration name. Example: 'Number of persons'.
'''</Summary>
<ApiMember(Description:="Configuration name. Example: 'Number of persons'.", IsRequired:=true)>
Public Overridable Property Name As String
'''<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)>
Public Overridable Property Description As String
'''<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)>
Public Overridable Property IconId As Integer
'''<Summary>
'''Field width. Example: 20
'''</Summary>
<ApiMember(Description:="Field width. Example: 20")>
Public Overridable Property Width As Integer
'''<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'")>
Public Overridable Property Datatype As String
'''<Summary>
'''Default value of the field. Example: '3'
'''</Summary>
<ApiMember(Description:="Default value of the field. Example: '3'")>
Public Overridable Property DefaultValue As String
'''<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")>
Public Overridable Property IsMandatory As Nullable(Of Boolean)
'''<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")>
Public Overridable Property MandatoryErrorMessage As String
'''<Summary>
'''Max lenght of the field. Default is 500
'''</Summary>
<ApiMember(Description:="Max lenght of the field. Default is 500", IsRequired:=true)>
Public Overridable Property MaxLength As Integer
'''<Summary>
'''If the field should have multiple lines. Defualt is false
'''</Summary>
<ApiMember(Description:="If the field should have multiple lines. Defualt is false")>
Public Overridable Property MultipleLineText As Nullable(Of Boolean)
'''<Summary>
'''Regular expression used for validation of the field
'''</Summary>
<ApiMember(Description:="Regular expression used for validation of the field")>
Public Overridable Property RegExId As Nullable(Of Integer)
'''<Summary>
'''Error message shown if the regular expression validation failed
'''</Summary>
<ApiMember(Description:="Error message shown if the regular expression validation failed")>
Public Overridable Property RegExErrorMessage As String
'''<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")>
Public Overridable Property IsPublic As Nullable(Of Boolean)
'''<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")>
Public Overridable Property IsHidden As Nullable(Of Boolean)
'''<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")>
Public Overridable Property Values As List(Of CustomFieldGroupValue)
'''<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.")>
Public Overridable Property Services As List(Of CustomFieldServices)
End Class
End Namespace
End Namespace
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=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 } ] }