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 .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 /rebatecodes HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	MaxNumberOfUses: 0,
	MaxNumberOfUsesPerCustomer: 0,
	FromTime: PT0S,
	ToTime: PT0S,
	RebateCodeTypeId: 0,
	RebateCodeValue: 0,
	RebateCodeSign: String,
	AutoGenerateRebateCodeSign: False,
	PersonalNote: String,
	DaysOfWeek: 
	[
		0
	],
	Services: 
	[
		0
	],
	Customers: 
	[
		00000000-0000-0000-0000-000000000000
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	CompanyId: 00000000-0000-0000-0000-000000000000,
	FromTime: PT0S,
	ToTime: PT0S,
	CreatedBy: String,
	UpdatedBy: String,
	PersonalNote: String,
	RebateCodeSign: String,
	RebateCodeValue: 0,
	RebateCodeTypeId: 0,
	Name: String,
	RebateCodeStatusId: 0,
	StatusName: String,
	MaxNumberOfUses: 0,
	MaxNumberOfUsesPerCustomer: 0,
	NumberOfUsesUsed: 0,
	NumberOfUsesPerCustomerUsed: 0,
	DaysOfWeek: 
	[
		{
			Id: 0,
			DayOfWeek: String,
			DayOfWeekTranslation: String,
			DayOfWeekActive: False,
			DayOfWeekSortOrder: 0
		}
	],
	Services: 
	[
		{
			Id: 0,
			Name: String,
			Description: String,
			Active: False
		}
	],
	Customers: 
	[
		{
			Firstname: String,
			Lastname: String,
			Email: String,
			Phone: String,
			ImageUrl: String
		}
	],
	RebateCodeTypesOptions: 
	[
		{
			ResponseStatus: 
			{
				ErrorCode: String,
				Message: String,
				StackTrace: String,
				Errors: 
				[
					{
						ErrorCode: String,
						FieldName: String,
						Message: String,
						Meta: 
						{
							String: String
						}
					}
				],
				Meta: 
				{
					String: String
				}
			},
			RebateCodeTypeItems: 
			[
				{
					Id: 0,
					Name: String,
					Description: String
				}
			]
		}
	],
	RebateCodeStatusOptions: 
	[
		{
			ResponseStatus: 
			{
				ErrorCode: String,
				Message: String,
				StackTrace: String,
				Errors: 
				[
					{
						ErrorCode: String,
						FieldName: String,
						Message: String,
						Meta: 
						{
							String: String
						}
					}
				],
				Meta: 
				{
					String: String
				}
			},
			RebateCodeStatusItems: 
			[
				{
					Id: 0,
					RebateCodeStatusName: String,
					RebateCodeStatusDescription: String
				}
			]
		}
	],
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}