BokaMera.API.Host

<back to all web services

UpdateCustomer

Requires Authentication
The following routes are available for this service:
PUT/customers/{Id}Update an existing customerUpdates an existing user if the current logged in user is allowed to update the specified customer. Users are only allowed to update their own info, administrators are allowed to update customer beloning to their company (if no account is created, email is added, if so the customer can only update it's own info).
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 UpdateCustomer
{
    /**
    * 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")
    var CompanyId:UUID? = null

    /**
    * customer id
    */
    @ApiMember(Description="customer id", IsRequired=true, ParameterType="path")
    var Id:UUID? = null

    var Firstname:String? = null
    var Lastname:String? = null
    var Phone:String? = null
    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")
    var CustomFields:ArrayList<AddCustomField> = ArrayList<AddCustomField>()

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

    var AccessKeysToDelete:ArrayList<DeleteUserAccessKey> = ArrayList<DeleteUserAccessKey>()
    var SubscribedToNewsletter:Boolean? = null
    var InvoiceAddress:InvoiceAddress? = null
}

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

open class AddUserAccessKey
{
    var Id:UUID? = null
    var CompanyId:UUID? = null
    var AccessKeyTypeId:Int? = null
    var Value:String? = null
    var CustomerId:UUID? = null
    var Description:String? = null
}

open class DeleteUserAccessKey
{
    var Id:UUID? = null
}

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

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

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

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

    /**
    * Field width. Example: 20 for 20px
    */
    @ApiMember(Description="Field width. Example: 20 for 20px")
    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'")
    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

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

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

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

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

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

    @Required()
    var AccessKeyTypeId:Int? = null

    @Required()
    var Value:String? = null

    @Required()
    var CustomerId:UUID? = null

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

open class BaseModel
{
}

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

PUT /customers/{Id} HTTP/1.1 
Host: testapi.bokamera.se 
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
		}
	],
	AccessKeysToDelete: 
	[
		{
			
		}
	],
	SubscribedToNewsletter: False,
	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

{
	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
	}
}