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).

export class CustomFieldValueResponse
{
    public Value: string;

    public constructor(init?: Partial<CustomFieldValueResponse>) { (Object as any).assign(this, init); }
}

export class CustomFieldConfigData
{
    /** @description Custom field id */
    // @ApiMember(Description="Custom field id")
    public Id: number;

    /** @description Configuration name. Example: 'Number of persons'. */
    // @ApiMember(Description="Configuration name. Example: 'Number of persons'.")
    public Name: string;

    /** @description Custom field description. Example: 'For how many persons is this booking?' */
    // @ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'")
    public Description: string;

    /** @description Field width. Example: 20 for 20px */
    // @ApiMember(Description="Field width. Example: 20 for 20px")
    public Width?: number;

    /** @description Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' */
    // @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")
    public DataType: string;

    /** @description Default value of the field. Example: '3' */
    // @ApiMember(Description="Default value of the field. Example: '3'")
    public DefaultValue: string;

    /** @description 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")
    public IsMandatory: boolean;

    /** @description 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")
    public MandatoryErrorMessage: string;

    /** @description Max lenght of the field */
    // @ApiMember(Description="Max lenght of the field")
    public MaxLength: number;

    /** @description If the field should have multiple lines */
    // @ApiMember(Description="If the field should have multiple lines")
    public MultipleLineText: boolean;

    /** @description Regular expression used for validation of the field */
    // @ApiMember(Description="Regular expression used for validation of the field")
    public RegEx: string;

    /** @description Error message shown if the regular expression validation failed */
    // @ApiMember(Description="Error message shown if the regular expression validation failed")
    public RegExErrorMessage: string;

    /** @description 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")
    public Values: CustomFieldValueResponse[];

    public constructor(init?: Partial<CustomFieldConfigData>) { (Object as any).assign(this, init); }
}

export class CustomFieldDataResponse
{
    public Id: number;
    public Column: string;
    public Name: string;
    public Description: string;
    public Value: string;
    /** @description Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' */
    // @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")
    public DataType: string;

    public constructor(init?: Partial<CustomFieldDataResponse>) { (Object as any).assign(this, init); }
}

export class CustomerCommentsResponse
{
    public Id: number;
    public CustomerId: string;
    public Comments: string;
    public Updated: string;
    public Created: string;
    public ImageUrl: string;

    public constructor(init?: Partial<CustomerCommentsResponse>) { (Object as any).assign(this, init); }
}

export class BaseModel
{

    public constructor(init?: Partial<BaseModel>) { (Object as any).assign(this, init); }
}

export class UserAccessKeys extends BaseModel
{
    // @Required()
    public CompanyId: string;

    // @Required()
    public AccessKeyTypeId: number;

    // @Required()
    public Value: string;

    // @Required()
    public CustomerId: string;

    public Description: string;
    // @Required()
    public Id: string;

    public constructor(init?: Partial<UserAccessKeys>) { super(init); (Object as any).assign(this, init); }
}

export class InvoiceAddress
{
    public CorporateIdentityNumber: string;
    public InvoiceAddress1: string;
    public InvoiceAddress2: string;
    public InvoiceCity: string;
    public InvoicePostalCode: string;
    public InvoiceCountryCode: string;

    public constructor(init?: Partial<InvoiceAddress>) { (Object as any).assign(this, init); }
}

export class CustomerQueryResponse
{
    public Id: string;
    public Firstname: string;
    public Lastname: string;
    public Email: string;
    public Phone: string;
    public ImageUrl: string;
    public CustomFields: CustomFieldConfigData[];
    public CustomFieldValues: CustomFieldDataResponse[];
    public Comments: CustomerCommentsResponse[];
    public AccessKeys: UserAccessKeys[];
    public Updated: string;
    public Created: string;
    public ResponseStatus: Object;
    public SubscribedToNewsletter: boolean;
    public InvoiceAddress: InvoiceAddress;

    public constructor(init?: Partial<CustomerQueryResponse>) { (Object as any).assign(this, init); }
}

export class AddCustomField
{
    public Id: number;
    public Value: string;

    public constructor(init?: Partial<AddCustomField>) { (Object as any).assign(this, init); }
}

export class AddUserAccessKey
{
    public Id?: string;
    public CompanyId?: string;
    public AccessKeyTypeId: number;
    public Value: string;
    public CustomerId?: string;
    public Description: string;

    public constructor(init?: Partial<AddUserAccessKey>) { (Object as any).assign(this, init); }
}

export class DeleteUserAccessKey
{
    public Id: string;

    public constructor(init?: Partial<DeleteUserAccessKey>) { (Object as any).assign(this, init); }
}

// @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")
export class UpdateCustomer
{
    /** @description 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")
    public CompanyId?: string;

    /** @description customer id */
    // @ApiMember(Description="customer id", IsRequired=true, ParameterType="path")
    public Id: string;

    public Firstname: string;
    public Lastname: string;
    public Phone: string;
    public Email: string;
    /** @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 */
    // @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 CustomFields: AddCustomField[];

    /** @description List of Access Keys */
    // @ApiMember(Description="List of Access Keys")
    public AccessKeys: AddUserAccessKey[];

    public AccessKeysToDelete: DeleteUserAccessKey[];
    public SubscribedToNewsletter?: boolean;
    public InvoiceAddress: InvoiceAddress;

    public constructor(init?: Partial<UpdateCustomer>) { (Object as any).assign(this, init); }
}

TypeScript UpdateCustomer DTOs

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

HTTP + XML

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: api.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<UpdateCustomer xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <AccessKeys>
    <AddUserAccessKey>
      <AccessKeyTypeId>0</AccessKeyTypeId>
      <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
      <CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
      <Description>String</Description>
      <Id>00000000-0000-0000-0000-000000000000</Id>
      <Value>String</Value>
    </AddUserAccessKey>
  </AccessKeys>
  <AccessKeysToDelete>
    <DeleteUserAccessKey>
      <Id>00000000-0000-0000-0000-000000000000</Id>
    </DeleteUserAccessKey>
  </AccessKeysToDelete>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <CustomFields>
    <AddCustomField>
      <Id>0</Id>
      <Value>String</Value>
    </AddCustomField>
  </CustomFields>
  <Email>String</Email>
  <Firstname>String</Firstname>
  <Id>00000000-0000-0000-0000-000000000000</Id>
  <InvoiceAddress>
    <CorporateIdentityNumber>String</CorporateIdentityNumber>
    <InvoiceAddress1>String</InvoiceAddress1>
    <InvoiceAddress2>String</InvoiceAddress2>
    <InvoiceCity>String</InvoiceCity>
    <InvoiceCountryCode>String</InvoiceCountryCode>
    <InvoicePostalCode>String</InvoicePostalCode>
  </InvoiceAddress>
  <Lastname>String</Lastname>
  <Phone>String</Phone>
  <SubscribedToNewsletter>false</SubscribedToNewsletter>
</UpdateCustomer>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CustomerQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <AccessKeys xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Db">
    <d2p1:UserAccessKeys>
      <d2p1:AccessKeyTypeId>0</d2p1:AccessKeyTypeId>
      <d2p1:CompanyId>00000000-0000-0000-0000-000000000000</d2p1:CompanyId>
      <d2p1:CustomerId>00000000-0000-0000-0000-000000000000</d2p1:CustomerId>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:Id>00000000-0000-0000-0000-000000000000</d2p1:Id>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:UserAccessKeys>
  </AccessKeys>
  <Comments>
    <CustomerCommentsResponse>
      <Comments>String</Comments>
      <Created>0001-01-01T00:00:00</Created>
      <CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
      <Id>0</Id>
      <ImageUrl i:nil="true" />
      <Updated>0001-01-01T00:00:00</Updated>
    </CustomerCommentsResponse>
  </Comments>
  <Created>0001-01-01T00:00:00</Created>
  <CustomFieldValues>
    <CustomFieldDataResponse>
      <Column>String</Column>
      <DataType>String</DataType>
      <Description>String</Description>
      <Id>0</Id>
      <Name>String</Name>
      <Value>String</Value>
    </CustomFieldDataResponse>
  </CustomFieldValues>
  <CustomFields>
    <CustomFieldConfigData>
      <DataType>String</DataType>
      <DefaultValue>String</DefaultValue>
      <Description>String</Description>
      <Id>0</Id>
      <IsMandatory>false</IsMandatory>
      <MandatoryErrorMessage>String</MandatoryErrorMessage>
      <MaxLength>0</MaxLength>
      <MultipleLineText>false</MultipleLineText>
      <Name>String</Name>
      <RegEx>String</RegEx>
      <RegExErrorMessage>String</RegExErrorMessage>
      <Values>
        <CustomFieldValueResponse>
          <Value>String</Value>
        </CustomFieldValueResponse>
      </Values>
      <Width>0</Width>
    </CustomFieldConfigData>
  </CustomFields>
  <Email>String</Email>
  <Firstname>String</Firstname>
  <Id>00000000-0000-0000-0000-000000000000</Id>
  <ImageUrl>String</ImageUrl>
  <InvoiceAddress>
    <CorporateIdentityNumber>String</CorporateIdentityNumber>
    <InvoiceAddress1>String</InvoiceAddress1>
    <InvoiceAddress2>String</InvoiceAddress2>
    <InvoiceCity>String</InvoiceCity>
    <InvoiceCountryCode>String</InvoiceCountryCode>
    <InvoicePostalCode>String</InvoicePostalCode>
  </InvoiceAddress>
  <Lastname>String</Lastname>
  <Phone>String</Phone>
  <ResponseStatus />
  <SubscribedToNewsletter>false</SubscribedToNewsletter>
  <Updated>0001-01-01T00:00:00</Updated>
</CustomerQueryResponse>