BokaMera.API.Host

<back to all web services

DeleteCustomField

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
DELETE/customfields/{Id}Delete a custom fieldDelete a custom field for the currently logged in user, only administrators are allowed to delete custom fields.
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomFieldLookupResponse:
    id: Optional[int] = None
    active: Optional[bool] = None
    sort_order: Optional[int] = None
    value: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomFieldServices:
    id: int = 0
    # @ApiMember(Description="Name of the service")
    name: Optional[str] = None
    """
    Name of the service
    """


    # @ApiMember(Description="The image url of the service")
    image_url: Optional[str] = None
    """
    The image url of the service
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomFieldQueryResponse:
    # @ApiMember(Description="Custom field id")
    id: int = 0
    """
    Custom field id
    """


    # @ApiMember(Description="Reference to company that owns the custom field configuration")
    company_id: Optional[str] = None
    """
    Reference to company that owns the custom field configuration
    """


    # @ApiMember(Description="Group id")
    group_id: Optional[int] = None
    """
    Group id
    """


    # @ApiMember(Description="Field id")
    field_id: int = 0
    """
    Field id
    """


    # @ApiMember(Description="Configuration name. Example: 'Number of persons'.")
    name: Optional[str] = None
    """
    Configuration name. Example: 'Number of persons'.
    """


    # @ApiMember(Description="Field width. Example: 20")
    width: int = 0
    """
    Field width. Example: 20
    """


    # @ApiMember(Description="Column in database where to store the information. Example: 'TextField1'")
    column: Optional[str] = None
    """
    Column in database where to store the information. Example: 'TextField1'
    """


    # @ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'")
    description: Optional[str] = None
    """
    Custom field description. Example: 'For how many persons is this booking?'
    """


    # @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")
    data_type: Optional[str] = None
    """
    Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'
    """


    # @ApiMember(Description="Default value of the field. Example: '3'")
    default_value: Optional[str] = None
    """
    Default value of the field. Example: '3'
    """


    # @ApiMember(Description="Determines if the field is required to have a value or not")
    is_mandatory: bool = False
    """
    Determines if the field is required to have a value or not
    """


    # @ApiMember(Description="Error message shown to the user if the field data is required but not entered")
    mandatory_error_message: Optional[str] = None
    """
    Error message shown to the user if the field data is required but not entered
    """


    # @ApiMember(Description="Max lenght of the field")
    max_length: int = 0
    """
    Max lenght of the field
    """


    # @ApiMember(Description="If the field should have multiple lines")
    multiple_line_text: bool = False
    """
    If the field should have multiple lines
    """


    # @ApiMember(Description="Regular expression used for validation of the field")
    reg_ex: Optional[str] = None
    """
    Regular expression used for validation of the field
    """


    # @ApiMember(Description="Regular expression id for validation of the field")
    reg_ex_id: Optional[int] = None
    """
    Regular expression id for validation of the field
    """


    # @ApiMember(Description="Error message shown if the regular expression validation failed")
    reg_ex_error_message: Optional[str] = None
    """
    Error message shown if the regular expression validation failed
    """


    # @ApiMember(Description="If the field is visible to the customer")
    is_public: bool = False
    """
    If the field is visible to the customer
    """


    # @ApiMember(Description="If the field should be hidden in lists")
    is_hidden: bool = False
    """
    If the field should be hidden in lists
    """


    # @ApiMember(Description="Table to which the field belongs")
    table: Optional[str] = None
    """
    Table to which the field belongs
    """


    # @ApiMember(Description="The values to select from if Datatype is DropDown for this custom field")
    values: Optional[List[CustomFieldLookupResponse]] = None
    """
    The values to select from if Datatype is DropDown for this custom field
    """


    # @ApiMember(Description="The services that is connected to the custom field")
    services: Optional[List[CustomFieldServices]] = None
    """
    The services that is connected to the custom field
    """


# @ValidateRequest(Validator="IsAuthenticated")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DeleteCustomField(ICompany):
    # @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
    company_id: Optional[str] = None
    """
    The company id, if empty will use the company id for the user you are logged in with.
    """


    # @ApiMember(Description="Id of the custom field to delete", IsRequired=true, ParameterType="path")
    id: int = 0
    """
    Id of the custom field to delete
    """

Python DeleteCustomField DTOs

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

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

DELETE /customfields/{Id} HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
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"}]}