BokaMera.API.Host

<back to all web services

CreateCustomer

Requires Authentication
Required role:bookingsupplier-administrator-write
The following routes are available for this service:
POST/customersCreate a new customerCreates a new customer, 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
Imports BokaMera.API.ServiceModel.Db

Namespace Global

    Namespace BokaMera.API.ServiceModel.Db

        Public Partial Class BaseModel
        End Class

        Public Partial Class UserAccessKeys
            Inherits BaseModel
            <Required>
            Public Overridable Property CompanyId As Guid

            <Required>
            Public Overridable Property AccessKeyTypeId As Integer

            <Required>
            Public Overridable Property Value As String

            <Required>
            Public Overridable Property CustomerId As Guid

            Public Overridable Property Description As String
            <Required>
            Public Overridable Property Id As Guid
        End Class
    End Namespace

    Namespace BokaMera.API.ServiceModel.Dtos

        Public Partial Class AddCustomField
            Public Overridable Property Id As Integer
            Public Overridable Property Value As String
        End Class

        Public Partial Class AddUserAccessKey
            Public Overridable Property Id As Nullable(Of Guid)
            Public Overridable Property CompanyId As Nullable(Of Guid)
            Public Overridable Property AccessKeyTypeId As Integer
            Public Overridable Property Value As String
            Public Overridable Property CustomerId As Nullable(Of Guid)
            Public Overridable Property Description As String
        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 CreateCustomer
            Public Sub New()
                CustomFields = New List(Of AddCustomField)
                AccessKeys = New List(Of AddUserAccessKey)
            End Sub

            '''<Summary>
            '''Enter the company and id for the customer, if blank company id and you are an admin, your company id will be used.
            '''</Summary>
            <ApiMember(Description:="Enter the company and id for the customer, if blank company id and you are an admin, your company id will be used.", ParameterType:="query")>
            Public Overridable Property CompanyId As Nullable(Of Guid)

            <ApiMember(IsRequired:=true)>
            Public Overridable Property Firstname As String

            <ApiMember(IsRequired:=true)>
            Public Overridable Property Lastname As String

            <ApiMember(IsRequired:=true)>
            Public Overridable Property Phone As String

            <ApiMember>
            Public Overridable Property Email As String

            '''<Summary>
            '''If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated
            '''</Summary>
            <ApiMember(Description:="If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated")>
            Public Overridable Property CustomFields As List(Of AddCustomField)

            '''<Summary>
            '''List of Access Keys
            '''</Summary>
            <ApiMember(Description:="List of Access Keys")>
            Public Overridable Property AccessKeys As List(Of AddUserAccessKey)

            '''<Summary>
            '''Customer invoice adress
            '''</Summary>
            <ApiMember(Description:="Customer invoice adress")>
            Public Overridable Property InvoiceAddress As InvoiceAddress
        End Class

        Public Partial Class CustomerCommentsResponse
            Public Overridable Property Id As Integer
            Public Overridable Property CustomerId As Guid
            Public Overridable Property Comments As String
            Public Overridable Property Updated As Date
            Public Overridable Property Created As Date
            Public Overridable Property ImageUrl As Uri
        End Class

        Public Partial Class CustomerQueryResponse
            Public Sub New()
                CustomFields = New List(Of CustomFieldConfigData)
                CustomFieldValues = New List(Of CustomFieldDataResponse)
                Comments = New List(Of CustomerCommentsResponse)
                AccessKeys = New List(Of UserAccessKeys)
            End Sub

            Public Overridable Property Id As Guid
            Public Overridable Property Firstname As String
            Public Overridable Property Lastname As String
            Public Overridable Property Email As String
            Public Overridable Property Phone As String
            Public Overridable Property ImageUrl As String
            Public Overridable Property CustomFields As List(Of CustomFieldConfigData)
            Public Overridable Property CustomFieldValues As List(Of CustomFieldDataResponse)
            Public Overridable Property Comments As List(Of CustomerCommentsResponse)
            Public Overridable Property AccessKeys As List(Of UserAccessKeys)
            Public Overridable Property Updated As Date
            Public Overridable Property Created As Date
            Public Overridable Property ResponseStatus As Object
            Public Overridable Property SubscribedToNewsletter As Boolean
            Public Overridable Property InvoiceAddress As InvoiceAddress
        End Class

        Public Partial Class CustomFieldConfigData
            Public Sub New()
                Values = New List(Of CustomFieldValueResponse)
            End Sub

            '''<Summary>
            '''Custom field id
            '''</Summary>
            <ApiMember(Description:="Custom field id")>
            Public Overridable Property Id 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>
            '''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>
            '''Field width. Example: 20 for 20px
            '''</Summary>
            <ApiMember(Description:="Field width. Example: 20 for 20px")>
            Public Overridable Property Width As Nullable(Of Integer)

            '''<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>
            '''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>
            '''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 CustomFieldValueResponse)
        End Class

        Public Partial Class CustomFieldDataResponse
            Public Overridable Property Id As Integer
            Public Overridable Property Column As String
            Public Overridable Property Name As String
            Public Overridable Property Description As String
            Public Overridable Property Value 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
        End Class

        Public Partial Class CustomFieldValueResponse
            Public Overridable Property Value As String
        End Class

        Public Partial Class UpdateCustomerResponse
            Inherits CustomerQueryResponse
            Public Sub New()
                DeletedAccessKeys = New List(Of UserAccessKeys)
                CreatedOrUpdatedAccessKeys = New List(Of UserAccessKeys)
            End Sub

            Public Overridable Property FacebookUserName As String
            Public Overridable Property UserId As Nullable(Of Guid)
            Public Overridable Property CompanyId As Nullable(Of Guid)
            Public Overridable Property CreatedDate As Nullable(Of Date)
            Public Overridable Property DeletedAccessKeys As List(Of UserAccessKeys)
            Public Overridable Property CreatedOrUpdatedAccessKeys As List(Of UserAccessKeys)
        End Class
    End Namespace
End Namespace

VB.NET CreateCustomer DTOs

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

HTTP + JSON

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

POST /customers HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Firstname":"String","Lastname":"String","Phone":"String","Email":"String","CustomFields":[{"Id":0,"Value":"String"}],"AccessKeys":[{"Id":"00000000-0000-0000-0000-000000000000","CompanyId":"00000000-0000-0000-0000-000000000000","AccessKeyTypeId":0,"Value":"String","CustomerId":"00000000-0000-0000-0000-000000000000","Description":"String"}],"InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"FacebookUserName":"String","UserId":"00000000-0000-0000-0000-000000000000","CompanyId":"00000000-0000-0000-0000-000000000000","CreatedDate":"0001-01-01T00:00:00","DeletedAccessKeys":[{"AccessKeyTypeId":0,"Value":"String","Description":"String"}],"CreatedOrUpdatedAccessKeys":[{"AccessKeyTypeId":0,"Value":"String","Description":"String"}],"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","ImageUrl":"String","CustomFields":[{"Id":0,"Name":"String","Description":"String","Width":0,"DataType":"String","DefaultValue":"String","IsMandatory":false,"MandatoryErrorMessage":"String","MaxLength":0,"MultipleLineText":false,"RegEx":"String","RegExErrorMessage":"String","Values":[{"Value":"String"}]}],"CustomFieldValues":[{"Id":0,"Column":"String","Name":"String","Description":"String","Value":"String","DataType":"String"}],"Comments":[{"Id":0,"Comments":"String"}],"AccessKeys":[{"AccessKeyTypeId":0,"Value":"String","Description":"String"}],"ResponseStatus":{},"SubscribedToNewsletter":false,"InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"}}