Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /services/prices/ | Create a price | Create a new price on the service |
---|
"use strict";
export class DayOfWeekDto {
/** @param {{DayOfWeekId?:number,DotNetDayOfWeekId?:number,DayOfWeek?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
DayOfWeekId;
/** @type {number} */
DotNetDayOfWeekId;
/** @type {string} */
DayOfWeek;
}
export class GroupBookingSettings {
/** @param {{Active?:boolean,Min?:number,Max?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {boolean} */
Active;
/** @type {number} */
Min;
/** @type {number} */
Max;
}
export class MultipleResourceSettings {
/** @param {{Active?:boolean,Min?:number,Max?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {boolean} */
Active;
/** @type {number} */
Min;
/** @type {number} */
Max;
}
export class ServiceInfoResponse {
/** @param {{Id?:number,Name?:string,Description?:string,ImageUrl?:string,LengthInMinutes?:number,MaxNumberOfSpotsPerBooking?:number,MinNumberOfSpotsPerBooking?:number,GroupBooking?:GroupBookingSettings,MultipleResource?:MultipleResourceSettings,IsGroupBooking?:boolean,IsPaymentEnabled?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {string} */
Name;
/** @type {string} */
Description;
/** @type {string} */
ImageUrl;
/** @type {?number} */
LengthInMinutes;
/** @type {number} */
MaxNumberOfSpotsPerBooking;
/** @type {number} */
MinNumberOfSpotsPerBooking;
/** @type {GroupBookingSettings} */
GroupBooking;
/** @type {MultipleResourceSettings} */
MultipleResource;
/** @type {boolean} */
IsGroupBooking;
/** @type {boolean} */
IsPaymentEnabled;
}
export class ServicePriceResponse {
/** @param {{CompanyId?:string,Id?:number,ServiceId?:number,Price?:number,CalculationTypeId?:number,CurrencyId?:string,PriceSign?:string,VAT?:number,Category?:string,PriceText?:string,From?:string,To?:string,DaysOfWeek?:DayOfWeekDto[],FromTime?:string,ToTime?:string,Service?:ServiceInfoResponse,IsTimeSpecific?:boolean,IsDaysOfWeekSpecific?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {string}
* @description The company id */
CompanyId;
/**
* @type {number}
* @description The price id */
Id;
/**
* @type {number}
* @description The service id */
ServiceId;
/**
* @type {number}
* @description The price */
Price;
/**
* @type {number}
* @description The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day */
CalculationTypeId;
/**
* @type {string}
* @description The price currency */
CurrencyId;
/**
* @type {string}
* @description The price sign */
PriceSign;
/**
* @type {number}
* @description The price VAT in percent */
VAT;
/**
* @type {string}
* @description The price category if price has a category */
Category;
/**
* @type {string}
* @description The price text to display */
PriceText;
/**
* @type {string}
* @description The valid from date for the price. */
From;
/**
* @type {string}
* @description The valid to date for the price. */
To;
/**
* @type {DayOfWeekDto[]}
* @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. */
DaysOfWeek;
/**
* @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 {ServiceInfoResponse} */
Service;
/**
* @type {boolean}
* @description If the price is only valid for a specific time span */
IsTimeSpecific;
/**
* @type {boolean}
* @description If the price is only valid for specific days of week */
IsDaysOfWeekSpecific;
}
export class CreateServicePrice {
/** @param {{CompanyId?:string,ServiceId?:number,Price?:number,CurrencyId?:string,CalculationTypeId?:number,VAT?:number,Category?:string,From?:string,To?:string,DaysOfWeek?:number[],FromTime?:string,ToTime?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {?string}
* @description The company id, if empty will use the company id for the user you are logged in with. */
CompanyId;
/**
* @type {number}
* @description The service id */
ServiceId;
/**
* @type {number}
* @description The price */
Price;
/**
* @type {string}
* @description The price currency */
CurrencyId;
/**
* @type {number}
* @description The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day */
CalculationTypeId;
/**
* @type {number}
* @description The price VAT in percent */
VAT;
/**
* @type {string}
* @description The price category if price has a category */
Category;
/**
* @type {string}
* @description The valid from date for the price. */
From;
/**
* @type {string}
* @description The valid to date for the price. */
To;
/**
* @type {number[]}
* @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. */
DaysOfWeek;
/**
* @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;
}
JavaScript CreateServicePrice DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /services/prices/ HTTP/1.1
Host: api.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
ServiceId: 0,
Price: 0,
CurrencyId: String,
CalculationTypeId: 0,
VAT: 0,
Category: String,
DaysOfWeek:
[
0
],
FromTime: PT0S,
ToTime: PT0S
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Id: 0, ServiceId: 0, Price: 0, CalculationTypeId: 0, CurrencyId: String, PriceSign: String, VAT: 0, Category: String, PriceText: String, DaysOfWeek: [ { DayOfWeekId: 0, DotNetDayOfWeekId: 0, DayOfWeek: String } ], FromTime: PT0S, ToTime: PT0S, Service: { Id: 0, Name: String, Description: String, LengthInMinutes: 0, MaxNumberOfSpotsPerBooking: 0, MinNumberOfSpotsPerBooking: 0, GroupBooking: { Active: False, Min: 0, Max: 0 }, MultipleResource: { Active: False, Min: 0, Max: 0 }, IsGroupBooking: False, IsPaymentEnabled: False }, IsTimeSpecific: False, IsDaysOfWeekSpecific: False }