| POST | /bookingreservations | Create a booking reservation (hold a slot) | Creates a reservation that holds the selected slot while the customer completes the booking flow. No booking is created yet. Only ServiceId, From and To are required so a bare "clicked a time" call works. |
|---|
// @ts-nocheck
export class CustomerBase implements ICustomerBase
{
public CustomerId?: string;
public Firstname: string;
public Lastname: string;
public Email: string;
public Phone: string;
public SubscribedToNewsletter: boolean;
public PersonalIdentityNumber: string;
public constructor(init?: Partial<CustomerBase>) { (Object as any).assign(this, init); }
}
export class CustomerToHandle extends CustomerBase
{
public constructor(init?: Partial<CustomerToHandle>) { super(init); (Object as any).assign(this, init); }
}
export class InvoiceAddressToHandle implements IInvoiceAddress
{
public CorporateIdentityNumber: string;
public InvoiceAddress1: string;
public InvoiceAddress2: string;
public InvoiceCity: string;
public InvoicePostalCode: string;
public InvoiceCountryCode: string;
public constructor(init?: Partial<InvoiceAddressToHandle>) { (Object as any).assign(this, init); }
}
export class ResourceToBook
{
public ResourceTypeId: number;
public ResourceId: number;
public constructor(init?: Partial<ResourceToBook>) { (Object as any).assign(this, init); }
}
export class ArticleToCreateBase
{
public ArticleId: number;
public Quantity: number;
public constructor(init?: Partial<ArticleToCreateBase>) { (Object as any).assign(this, init); }
}
export enum PaymentOptions
{
DefaultSetting = 'DefaultSetting',
BookWithoutPayment = 'BookWithoutPayment',
BookWithPaymentMessageToCustomer = 'BookWithPaymentMessageToCustomer',
BookWithManualPayment = 'BookWithManualPayment',
}
export class AddCustomField
{
public Id: number;
public Value: string;
public constructor(init?: Partial<AddCustomField>) { (Object as any).assign(this, init); }
}
export class CreateBookingBase implements ICreateBookingBase
{
/** @description The company id, if empty will use the company id for the user you are logged in with. */
// @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
public CompanyId?: string;
/** @description If you want to book on an existing customer instead of CustomerToBook info set the CustomerId here. Set Empty Guid (00000000-0000-0000-0000-000000000000) if you want to book without any customer, this is only allowed by admin. The customer id is shown in the customer list named as id. When booking as customer (no admin) leave this field blank. */
// @ApiMember(Description="If you want to book on an existing customer instead of CustomerToBook info set the CustomerId here. Set Empty Guid (00000000-0000-0000-0000-000000000000) if you want to book without any customer, this is only allowed by admin. The customer id is shown in the customer list named as id. When booking as customer (no admin) leave this field blank.")
public CustomerId?: string;
/** @description If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here. */
// @ApiMember(Description="If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here.")
public PinCode: string;
/** @description If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinary profile. */
// @ApiMember(Description="If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinary profile. ")
public Customer: CustomerToHandle;
/** @description If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinary profile. */
// @ApiMember(Description="If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinary profile. ")
public InvoiceAddress: InvoiceAddressToHandle;
/** @description The service to be booked */
// @ApiMember(Description="The service to be booked", IsRequired=true)
public ServiceId: number;
/** @description If you want to add comments to a booking you can add them here, this comments are never shared with the customer */
// @ApiMember(Description="If you want to add comments to a booking you can add them here, this comments are never shared with the customer")
public BookedComments: string;
/** @description If you want to add comments to the booking that is sent to the customer, you can add them here. Comments will be sent in the booking confirmation */
// @ApiMember(Description="If you want to add comments to the booking that is sent to the customer, you can add them here. Comments will be sent in the booking confirmation")
public CommentsToCustomer: string;
public Resources: ResourceToBook[] = [];
/** @description Rebate codes applied to booking */
// @ApiMember(Description="Rebate codes applied to booking")
public RebateCodeIds?: number[];
/** @description Article ids that should be booked with the service. The articles must be of type ServiceAddonArticle and connected to the service. */
// @ApiMember(Description="Article ids that should be booked with the service. The articles must be of type ServiceAddonArticle and connected to the service.", IsRequired=true)
public Articles: ArticleToCreateBase[] = [];
/** @description If you want to send Email reminder */
// @ApiMember(Description="If you want to send Email reminder")
public SendEmailReminder?: boolean;
/** @description If you want to send SMS reminder */
// @ApiMember(Description="If you want to send SMS reminder")
public SendSmsReminder?: boolean;
/** @description If you want to send SMS confirmation */
// @ApiMember(Description="If you want to send SMS confirmation")
public SendSmsConfirmation?: boolean;
/** @description Only admins are allowed to not send an email confirmation. Default is true */
// @ApiMember(Description="Only admins are allowed to not send an email confirmation. Default is true")
public SendEmailConfirmation?: boolean;
/** @description If payment is enabled and you're an administrator, optional to choose payment option, if empty then the default settings will be used. Following payment options exists. DefaultSetting = 0, BookWithoutPayment = 1 (will be direcyly booked without payment), BookWithPaymentMessageToCustomer = 2 (will set status AwaitingPayment and send payment instructions to customer), BookWithManualPayment = 3 (Will set status AwaitingPaymentNoTimeLimit and Admin will need to manually mark the booking as payed when recieved payment). */
// @ApiMember(Description="If payment is enabled and you're an administrator, optional to choose payment option, if empty then the default settings will be used. Following payment options exists. DefaultSetting = 0, BookWithoutPayment = 1 (will be direcyly booked without payment), BookWithPaymentMessageToCustomer = 2 (will set status AwaitingPayment and send payment instructions to customer), BookWithManualPayment = 3 (Will set status AwaitingPaymentNoTimeLimit and Admin will need to manually mark the booking as payed when recieved payment).")
public PaymentOption: PaymentOptions;
/** @description If Custom Fields are added to the booking, here you will send the id and the value for each custom field to be saved */
// @ApiMember(Description="If Custom Fields are added to the booking, here you will send the id and the value for each custom field to be saved")
public CustomFields: AddCustomField[] = [];
/** @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 CustomerCustomFields: AddCustomField[] = [];
/** @description If want to allow to book outside the service schedules. This means you can book a time after the schedule opening hours as long as the resource are available. This is only allowed by administrators */
// @ApiMember(Description="If want to allow to book outside the service schedules. This means you can book a time after the schedule opening hours as long as the resource are available. This is only allowed by administrators")
public AllowBookingOutsideSchedules: boolean;
/** @description Ids of tags to attach to the booking at creation time. Tags must have Scope = Booking and belong to the company. */
// @ApiMember(Description="Ids of tags to attach to the booking at creation time. Tags must have Scope = Booking and belong to the company.")
public TagIds: number[] = [];
public constructor(init?: Partial<CreateBookingBase>) { (Object as any).assign(this, init); }
}
export class BookingReservationResponse
{
/** @description The opaque session key that identifies the reservation. */
// @ApiMember(Description="The opaque session key that identifies the reservation.")
public SessionKey: string;
/** @description The company id. */
// @ApiMember(Description="The company id.")
public CompanyId: string;
/** @description The reserved service id. */
// @ApiMember(Description="The reserved service id.")
public ServiceId: number;
/** @description The reservation start. */
// @ApiMember(Description="The reservation start.")
public From: string;
/** @description The reservation end. */
// @ApiMember(Description="The reservation end.")
public To: string;
/** @description The BookingReservationStatus value. */
// @ApiMember(Description="The BookingReservationStatus value.")
public StatusCode: number;
/** @description The BookingReservationStatus name. */
// @ApiMember(Description="The BookingReservationStatus name.")
public StatusName: string;
/** @description When the hold expires (company-local time). */
// @ApiMember(Description="When the hold expires (company-local time).")
public ExpirationDatetime: string;
/** @description Number of reserved spots. */
// @ApiMember(Description="Number of reserved spots.")
public NumberOfBookedSpots: number;
/** @description The computed price of the reservation, if any. */
// @ApiMember(Description="The computed price of the reservation, if any.")
public Price?: number;
/** @description The currency of the price, if any. */
// @ApiMember(Description="The currency of the price, if any.")
public CurrencyId: string;
/** @description Ids of the resources held by the reservation. */
// @ApiMember(Description="Ids of the resources held by the reservation.")
public ResourceIds: number[] = [];
/** @description The full in-progress selection payload (wizard/session state) as JSON. */
// @ApiMember(Description="The full in-progress selection payload (wizard/session state) as JSON.")
public SelectionPayload: string;
public ResponseStatus: ResponseStatus;
public constructor(init?: Partial<BookingReservationResponse>) { (Object as any).assign(this, init); }
}
export class QuantityToBook
{
/** @description If service has a price, enter the price id for that price. If no price exists for the service set 0 as PriceId. If you put 0 and a price exists, it will use that price (only works if just one price exists for the current selected date to book) */
// @ApiMember(Description="If service has a price, enter the price id for that price. If no price exists for the service set 0 as PriceId. If you put 0 and a price exists, it will use that price (only works if just one price exists for the current selected date to book)", IsRequired=true)
public PriceId: number;
/** @description Set the number of spots or resources you want to book on the specific price category */
// @ApiMember(Description="Set the number of spots or resources you want to book on the specific price category", IsRequired=true)
public Quantity: number;
/** @description If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information. */
// @ApiMember(Description="If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.")
public OccupiesSpot: boolean;
public constructor(init?: Partial<QuantityToBook>) { (Object as any).assign(this, init); }
}
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="The selected slot is no longer available", StatusCode=409)
export class CreateBookingReservation extends CreateBookingBase implements IInterval
{
/** @description The datetime you want to start the reservation. */
// @ApiMember(Description="The datetime you want to start the reservation.", IsRequired=true)
public From: string;
/** @description The datetime you want to end the reservation. */
// @ApiMember(Description="The datetime you want to end the reservation.", IsRequired=true)
public To: string;
/** @description Set the number of spots you want to reserve. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot. */
// @ApiMember(Description="Set the number of spots you want to reserve. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot.")
public Quantities: QuantityToBook[] = [];
public constructor(init?: Partial<CreateBookingReservation>) { super(init); (Object as any).assign(this, init); }
}
TypeScript CreateBookingReservation DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /bookingreservations HTTP/1.1
Host: testapi.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateBookingReservation xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<AllowBookingOutsideSchedules xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">false</AllowBookingOutsideSchedules>
<Articles xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">
<d2p1:ArticleToCreateBase>
<d2p1:ArticleId>0</d2p1:ArticleId>
<d2p1:Quantity>0</d2p1:Quantity>
</d2p1:ArticleToCreateBase>
</Articles>
<BookedComments xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">String</BookedComments>
<CommentsToCustomer xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">String</CommentsToCustomer>
<CompanyId xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">00000000-0000-0000-0000-000000000000</CompanyId>
<CustomFields xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">
<d2p1:AddCustomField>
<d2p1:Id>0</d2p1:Id>
<d2p1:Value>String</d2p1:Value>
</d2p1:AddCustomField>
</CustomFields>
<Customer xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">
<CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
<Email>String</Email>
<Firstname>String</Firstname>
<Lastname>String</Lastname>
<PersonalIdentityNumber>String</PersonalIdentityNumber>
<Phone>String</Phone>
<SubscribedToNewsletter>false</SubscribedToNewsletter>
</Customer>
<CustomerCustomFields xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">
<d2p1:AddCustomField>
<d2p1:Id>0</d2p1:Id>
<d2p1:Value>String</d2p1:Value>
</d2p1:AddCustomField>
</CustomerCustomFields>
<CustomerId xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">00000000-0000-0000-0000-000000000000</CustomerId>
<InvoiceAddress xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">
<d2p1:CorporateIdentityNumber>String</d2p1:CorporateIdentityNumber>
<d2p1:InvoiceAddress1>String</d2p1:InvoiceAddress1>
<d2p1:InvoiceAddress2>String</d2p1:InvoiceAddress2>
<d2p1:InvoiceCity>String</d2p1:InvoiceCity>
<d2p1:InvoiceCountryCode>String</d2p1:InvoiceCountryCode>
<d2p1:InvoicePostalCode>String</d2p1:InvoicePostalCode>
</InvoiceAddress>
<PaymentOption xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">DefaultSetting</PaymentOption>
<PinCode xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">String</PinCode>
<RebateCodeIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">
<d2p1:int>0</d2p1:int>
</RebateCodeIds>
<Resources xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">
<d2p1:ResourceToBook>
<d2p1:ResourceId>0</d2p1:ResourceId>
<d2p1:ResourceTypeId>0</d2p1:ResourceTypeId>
</d2p1:ResourceToBook>
</Resources>
<SendEmailConfirmation xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">false</SendEmailConfirmation>
<SendEmailReminder xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">false</SendEmailReminder>
<SendSmsConfirmation xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">false</SendSmsConfirmation>
<SendSmsReminder xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">false</SendSmsReminder>
<ServiceId xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">0</ServiceId>
<TagIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos.Commons">
<d2p1:int>0</d2p1:int>
</TagIds>
<From>0001-01-01T00:00:00</From>
<Quantities>
<QuantityToBook>
<OccupiesSpot>false</OccupiesSpot>
<PriceId>0</PriceId>
<Quantity>0</Quantity>
</QuantityToBook>
</Quantities>
<To>0001-01-01T00:00:00</To>
</CreateBookingReservation>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<BookingReservationResponse 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>
<CurrencyId>String</CurrencyId>
<ExpirationDatetime>0001-01-01T00:00:00</ExpirationDatetime>
<From>0001-01-01T00:00:00</From>
<NumberOfBookedSpots>0</NumberOfBookedSpots>
<Price>0</Price>
<ResourceIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:int>0</d2p1:int>
</ResourceIds>
<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>
<SelectionPayload>String</SelectionPayload>
<ServiceId>0</ServiceId>
<SessionKey>00000000-0000-0000-0000-000000000000</SessionKey>
<StatusCode>0</StatusCode>
<StatusName>String</StatusName>
<To>0001-01-01T00:00:00</To>
</BookingReservationResponse>