BokaMera.API.Host

<back to all web services

CreateRebateCode

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/rebatecodesCreate RebateCode.Create RebateCode.
"use strict";
export class DaysOfWeekResponse {
    /** @param {{Id?:number,DayOfWeek?:string,DayOfWeekTranslation?:string,DayOfWeekActive?:boolean,DayOfWeekSortOrder?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /** @type {string} */
    DayOfWeek;
    /** @type {string} */
    DayOfWeekTranslation;
    /** @type {?boolean} */
    DayOfWeekActive;
    /** @type {?number} */
    DayOfWeekSortOrder;
}
export class RebateCodeServiceResponse {
    /** @param {{Id?:number,Name?:string,Description?:string,Active?:boolean}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /** @type {string} */
    Name;
    /** @type {string} */
    Description;
    /** @type {boolean} */
    Active;
}
export class RebateCodeCustomerResponse {
    /** @param {{Id?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string,ImageUrl?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    Id;
    /** @type {string} */
    Firstname;
    /** @type {string} */
    Lastname;
    /** @type {string} */
    Email;
    /** @type {string} */
    Phone;
    /** @type {string} */
    ImageUrl;
}
export class RebateCodeTypeItem {
    /** @param {{Id?:number,Name?:string,Description?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /** @type {string} */
    Name;
    /** @type {string} */
    Description;
}
export class RebateCodeTypeResponse {
    /** @param {{ResponseStatus?:ResponseStatus,RebateCodeTypeItems?:RebateCodeTypeItem[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {ResponseStatus} */
    ResponseStatus;
    /** @type {RebateCodeTypeItem[]} */
    RebateCodeTypeItems;
}
export class RebateCodeStatusItem {
    /** @param {{Id?:number,RebateCodeStatusName?:string,RebateCodeStatusDescription?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /** @type {string} */
    RebateCodeStatusName;
    /** @type {string} */
    RebateCodeStatusDescription;
}
export class RebateCodeStatusResponse {
    /** @param {{ResponseStatus?:ResponseStatus,RebateCodeStatusItems?:RebateCodeStatusItem[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {ResponseStatus} */
    ResponseStatus;
    /** @type {RebateCodeStatusItem[]} */
    RebateCodeStatusItems;
}
export class RebateCodeResponse {
    /** @param {{Id?:number,CompanyId?:string,ValidFrom?:string,ValidTo?:string,FromTime?:string,ToTime?:string,CreatedBy?:string,Created?:string,UpdatedBy?:string,Updated?:string,PersonalNote?:string,RebateCodeSign?:string,RebateCodeValue?:number,RebateCodeTypeId?:number,Name?:string,RebateCodeStatusId?:number,StatusName?:string,MaxNumberOfUses?:number,MaxNumberOfUsesPerCustomer?:number,NumberOfUsesUsed?:number,NumberOfUsesPerCustomerUsed?:number,DaysOfWeek?:DaysOfWeekResponse[],Services?:RebateCodeServiceResponse[],Customers?:RebateCodeCustomerResponse[],RebateCodeTypesOptions?:RebateCodeTypeResponse[],RebateCodeStatusOptions?:RebateCodeStatusResponse[],ResponseStatus?:ResponseStatus}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /** @type {?string} */
    CompanyId;
    /** @type {string} */
    ValidFrom;
    /** @type {string} */
    ValidTo;
    /**
     * @type {string}
     * @description If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update. */
    FromTime;
    /**
     * @type {string}
     * @description If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters. */
    ToTime;
    /** @type {string} */
    CreatedBy;
    /** @type {string} */
    Created;
    /** @type {string} */
    UpdatedBy;
    /** @type {string} */
    Updated;
    /** @type {string} */
    PersonalNote;
    /** @type {string} */
    RebateCodeSign;
    /** @type {number} */
    RebateCodeValue;
    /** @type {number} */
    RebateCodeTypeId;
    /** @type {string} */
    Name;
    /** @type {number} */
    RebateCodeStatusId;
    /** @type {string} */
    StatusName;
    /** @type {number} */
    MaxNumberOfUses;
    /** @type {number} */
    MaxNumberOfUsesPerCustomer;
    /** @type {number} */
    NumberOfUsesUsed;
    /** @type {number} */
    NumberOfUsesPerCustomerUsed;
    /** @type {DaysOfWeekResponse[]} */
    DaysOfWeek;
    /** @type {RebateCodeServiceResponse[]} */
    Services;
    /** @type {RebateCodeCustomerResponse[]} */
    Customers;
    /** @type {RebateCodeTypeResponse[]} */
    RebateCodeTypesOptions;
    /** @type {RebateCodeStatusResponse[]} */
    RebateCodeStatusOptions;
    /** @type {ResponseStatus} */
    ResponseStatus;
}
export class CreateRebateCode {
    /** @param {{CompanyId?:string,MaxNumberOfUses?:number,MaxNumberOfUsesPerCustomer?:number,ValidFrom?:string,ValidTo?:string,FromTime?:string,ToTime?:string,RebateCodeTypeId?:number,RebateCodeValue?:number,RebateCodeSign?:string,AutoGenerateRebateCodeSign?:boolean,PersonalNote?:string,DaysOfWeek?:number[],Services?:number[],Customers?:string[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {?string} */
    CompanyId;
    /**
     * @type {?number}
     * @description The default value is 9999 */
    MaxNumberOfUses;
    /**
     * @type {?number}
     * @description The default value is 1 */
    MaxNumberOfUsesPerCustomer;
    /** @type {string} */
    ValidFrom;
    /** @type {string} */
    ValidTo;
    /**
     * @type {?string}
     * @description If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update. */
    FromTime;
    /**
     * @type {?string}
     * @description If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters. */
    ToTime;
    /**
     * @type {number}
     * @description 1 - Percent, 2 - Сurrency */
    RebateCodeTypeId;
    /** @type {number} */
    RebateCodeValue;
    /**
     * @type {string}
     * @description If AutoGenerateRebateCodeSign=false - more than four letters, unique among active codes */
    RebateCodeSign;
    /**
     * @type {boolean}
     * @description AutoGenerateRebateCodeSign=true - random generate code */
    AutoGenerateRebateCodeSign;
    /** @type {string} */
    PersonalNote;
    /** @type {number[]} */
    DaysOfWeek;
    /** @type {number[]} */
    Services;
    /** @type {string[]} */
    Customers;
}

JavaScript CreateRebateCode 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.

POST /rebatecodes HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CreateRebateCode xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <AutoGenerateRebateCodeSign>false</AutoGenerateRebateCodeSign>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <Customers xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:guid>00000000-0000-0000-0000-000000000000</d2p1:guid>
  </Customers>
  <DaysOfWeek xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </DaysOfWeek>
  <FromTime>PT0S</FromTime>
  <MaxNumberOfUses>0</MaxNumberOfUses>
  <MaxNumberOfUsesPerCustomer>0</MaxNumberOfUsesPerCustomer>
  <PersonalNote>String</PersonalNote>
  <RebateCodeSign>String</RebateCodeSign>
  <RebateCodeTypeId>0</RebateCodeTypeId>
  <RebateCodeValue>0</RebateCodeValue>
  <Services xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </Services>
  <ToTime>PT0S</ToTime>
  <ValidFrom>0001-01-01T00:00:00</ValidFrom>
  <ValidTo>0001-01-01T00:00:00</ValidTo>
</CreateRebateCode>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<RebateCodeResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <Created>0001-01-01T00:00:00</Created>
  <CreatedBy>String</CreatedBy>
  <Customers>
    <RebateCodeCustomerResponse>
      <Email>String</Email>
      <Firstname>String</Firstname>
      <Id>00000000-0000-0000-0000-000000000000</Id>
      <ImageUrl>String</ImageUrl>
      <Lastname>String</Lastname>
      <Phone>String</Phone>
    </RebateCodeCustomerResponse>
  </Customers>
  <DaysOfWeek>
    <DaysOfWeekResponse>
      <DayOfWeek>String</DayOfWeek>
      <DayOfWeekActive>false</DayOfWeekActive>
      <DayOfWeekSortOrder>0</DayOfWeekSortOrder>
      <DayOfWeekTranslation>String</DayOfWeekTranslation>
      <Id>0</Id>
    </DaysOfWeekResponse>
  </DaysOfWeek>
  <FromTime>PT0S</FromTime>
  <Id>0</Id>
  <MaxNumberOfUses>0</MaxNumberOfUses>
  <MaxNumberOfUsesPerCustomer>0</MaxNumberOfUsesPerCustomer>
  <Name>String</Name>
  <NumberOfUsesPerCustomerUsed>0</NumberOfUsesPerCustomerUsed>
  <NumberOfUsesUsed>0</NumberOfUsesUsed>
  <PersonalNote>String</PersonalNote>
  <RebateCodeSign>String</RebateCodeSign>
  <RebateCodeStatusId>0</RebateCodeStatusId>
  <RebateCodeStatusOptions>
    <RebateCodeStatusResponse>
      <RebateCodeStatusItems>
        <RebateCodeStatusItem>
          <Id>0</Id>
          <RebateCodeStatusDescription>String</RebateCodeStatusDescription>
          <RebateCodeStatusName>String</RebateCodeStatusName>
        </RebateCodeStatusItem>
      </RebateCodeStatusItems>
      <ResponseStatus xmlns:d4p1="http://schemas.servicestack.net/types">
        <d4p1:ErrorCode>String</d4p1:ErrorCode>
        <d4p1:Message>String</d4p1:Message>
        <d4p1:StackTrace>String</d4p1:StackTrace>
        <d4p1:Errors>
          <d4p1:ResponseError>
            <d4p1:ErrorCode>String</d4p1:ErrorCode>
            <d4p1:FieldName>String</d4p1:FieldName>
            <d4p1:Message>String</d4p1:Message>
            <d4p1:Meta xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
              <d7p1:KeyValueOfstringstring>
                <d7p1:Key>String</d7p1:Key>
                <d7p1:Value>String</d7p1:Value>
              </d7p1:KeyValueOfstringstring>
            </d4p1:Meta>
          </d4p1:ResponseError>
        </d4p1:Errors>
        <d4p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d4p1:Meta>
      </ResponseStatus>
    </RebateCodeStatusResponse>
  </RebateCodeStatusOptions>
  <RebateCodeTypeId>0</RebateCodeTypeId>
  <RebateCodeTypesOptions>
    <RebateCodeTypeResponse>
      <RebateCodeTypeItems>
        <RebateCodeTypeItem>
          <Description>String</Description>
          <Id>0</Id>
          <Name>String</Name>
        </RebateCodeTypeItem>
      </RebateCodeTypeItems>
      <ResponseStatus xmlns:d4p1="http://schemas.servicestack.net/types">
        <d4p1:ErrorCode>String</d4p1:ErrorCode>
        <d4p1:Message>String</d4p1:Message>
        <d4p1:StackTrace>String</d4p1:StackTrace>
        <d4p1:Errors>
          <d4p1:ResponseError>
            <d4p1:ErrorCode>String</d4p1:ErrorCode>
            <d4p1:FieldName>String</d4p1:FieldName>
            <d4p1:Message>String</d4p1:Message>
            <d4p1:Meta xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
              <d7p1:KeyValueOfstringstring>
                <d7p1:Key>String</d7p1:Key>
                <d7p1:Value>String</d7p1:Value>
              </d7p1:KeyValueOfstringstring>
            </d4p1:Meta>
          </d4p1:ResponseError>
        </d4p1:Errors>
        <d4p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d4p1:Meta>
      </ResponseStatus>
    </RebateCodeTypeResponse>
  </RebateCodeTypesOptions>
  <RebateCodeValue>0</RebateCodeValue>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <Services>
    <RebateCodeServiceResponse>
      <Active>false</Active>
      <Description>String</Description>
      <Id>0</Id>
      <Name>String</Name>
    </RebateCodeServiceResponse>
  </Services>
  <StatusName>String</StatusName>
  <ToTime>PT0S</ToTime>
  <Updated>0001-01-01T00:00:00</Updated>
  <UpdatedBy>String</UpdatedBy>
  <ValidFrom>0001-01-01T00:00:00</ValidFrom>
  <ValidTo>0001-01-01T00:00:00</ValidTo>
</RebateCodeResponse>