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.
import java.math.*
import java.util.*
import java.io.InputStream
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 CreateCustomer
{
    /**
    * Enter the company and id for the customer, if blank company id and you are an admin, your company id will be used.
    */
    @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")
    open var CompanyId:UUID? = null

    @ApiMember(IsRequired=true)
    open var Firstname:String? = null

    @ApiMember(IsRequired=true)
    open var Lastname:String? = null

    @ApiMember(IsRequired=true)
    open var Phone:String? = null

    @ApiMember()
    open var Email:String? = null

    /**
    * If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated
    */
    @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")
    open var CustomFields:ArrayList<AddCustomField>? = null

    /**
    * List of Access Keys
    */
    @ApiMember(Description="List of Access Keys")
    open var AccessKeys:ArrayList<AddUserAccessKey>? = null

    /**
    * Customer invoice adress
    */
    @ApiMember(Description="Customer invoice adress")
    open var InvoiceAddress:InvoiceAddressToHandle? = null
}

open class AddCustomField
{
    open var Id:Int? = null
    open var Value:String? = null
}

open class AddUserAccessKey
{
    /**
    * Specify 'Id' to update an existing access key, leave empty to create a new one
    */
    @ApiMember(Description="Specify 'Id' to update an existing access key, leave empty to create a new one")
    open var Id:UUID? = null

    /**
    * The company ID associated with this access key
    */
    @ApiMember(Description="The company ID associated with this access key")
    open var CompanyId:UUID? = null

    /**
    * The type of access key to create
    */
    @ApiMember(Description="The type of access key to create")
    open var AccessKeyTypeId:Int? = null

    /**
    * The actual key value or token
    */
    @ApiMember(Description="The actual key value or token")
    open var Value:String? = null

    /**
    * The customer ID this access key is associated with
    */
    @ApiMember(Description="The customer ID this access key is associated with")
    open var CustomerId:UUID? = null

    /**
    * A description or note about this access key
    */
    @ApiMember(Description="A description or note about this access key")
    open var Description:String? = null
}

open class InvoiceAddressToHandle
{
    open var CorporateIdentityNumber:String? = null
    open var InvoiceAddress1:String? = null
    open var InvoiceAddress2:String? = null
    open var InvoiceCity:String? = null
    open var InvoicePostalCode:String? = null
    open var InvoiceCountryCode:String? = null
}

open class UpdateCustomerResponse : CustomerQueryResponse()
{
    open var FacebookUserName:String? = null
    open var UserId:UUID? = null
    open var CompanyId:UUID? = null
    open var CreatedDate:Date? = null
    open var DeletedAccessKeys:ArrayList<UserAccessKeys>? = null
    open var CreatedOrUpdatedAccessKeys:ArrayList<UserAccessKeys>? = null
}

open class CustomerQueryResponse
{
    open var Id:UUID? = null
    open var Firstname:String? = null
    open var Lastname:String? = null
    open var Email:String? = null
    open var Phone:String? = null
    open var ImageUrl:String? = null
    open var CustomFields:ArrayList<CustomFieldConfigData>? = null
    open var CustomFieldValues:ArrayList<CustomFieldDataResponse>? = null
    open var Comments:ArrayList<CustomerCommentsResponse>? = null
    open var AccessKeys:ArrayList<UserAccessKeys>? = null
    open var Updated:Date? = null
    open var Created:Date? = null
    open var ResponseStatus:Object? = null
    open var SubscribedToNewsletter:Boolean? = null
    open var InvoiceAddress:InvoiceAddressResponse? = null
}

open class CustomFieldConfigData
{
    /**
    * Custom field id
    */
    @ApiMember(Description="Custom field id")
    open var Id:Int? = null

    /**
    * Configuration name. Example: 'Number of persons'.
    */
    @ApiMember(Description="Configuration name. Example: 'Number of persons'.")
    open 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?'")
    open var Description:String? = null

    /**
    * Field width. Example: 20 for 20px
    */
    @ApiMember(Description="Field width. Example: 20 for 20px")
    open var Width:Int? = 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'")
    open var DataType:String? = null

    /**
    * Default value of the field. Example: '3'
    */
    @ApiMember(Description="Default value of the field. Example: '3'")
    open 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")
    open 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")
    open var MandatoryErrorMessage:String? = null

    /**
    * Max lenght of the field
    */
    @ApiMember(Description="Max lenght of the field")
    open var MaxLength:Int? = null

    /**
    * If the field should have multiple lines
    */
    @ApiMember(Description="If the field should have multiple lines")
    open var MultipleLineText:Boolean? = null

    /**
    * Regular expression used for validation of the field
    */
    @ApiMember(Description="Regular expression used for validation of the field")
    open var RegEx:String? = null

    /**
    * Error message shown if the regular expression validation failed
    */
    @ApiMember(Description="Error message shown if the regular expression validation failed")
    open var RegExErrorMessage: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")
    open var Values:ArrayList<CustomFieldValueResponse>? = null
}

open class CustomFieldValueResponse
{
    open var Value:String? = null
}

open class CustomFieldDataResponse
{
    open var Id:Int? = null
    open var Column:String? = null
    open var Name:String? = null
    open var Description:String? = null
    open var Value: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'")
    open var DataType:String? = null
}

open class CustomerCommentsResponse
{
    open var Id:Int? = null
    open var CustomerId:UUID? = null
    open var Comments:String? = null
    open var Updated:Date? = null
    open var Created:Date? = null
    open var ImageUrl:Uri? = null
}

open class UserAccessKeys : BaseModel()
{
    @Required()
    open var CompanyId:UUID? = null

    @Required()
    open var AccessKeyTypeId:Int? = null

    @Required()
    open var Value:String? = null

    @Required()
    open var CustomerId:UUID? = null

    open var Description:String? = null
    @Required()
    open var Id:UUID? = null
}

open class BaseModel
{
}

open class InvoiceAddressResponse
{
    open var InvoiceAddressId:UUID? = null
    open var UserId:UUID? = null
    open var CorporateIdentityNumber:String? = null
    open var InvoiceAddress1:String? = null
    open var InvoiceAddress2:String? = null
    open var InvoiceCity:String? = null
    open var InvoicePostalCode:String? = null
    open var InvoiceCountryCode:String? = null
}

Kotlin CreateCustomer 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.

POST /customers HTTP/1.1 
Host: api.bookmore.com 
Accept: text/jsv
Content-Type: text/jsv
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: text/jsv
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: 
	{
		UserId: 00000000-0000-0000-0000-000000000000,
		CorporateIdentityNumber: String,
		InvoiceAddress1: String,
		InvoiceAddress2: String,
		InvoiceCity: String,
		InvoicePostalCode: String,
		InvoiceCountryCode: String
	}
}