BokaMera.API.Host

<back to all web services

CreateBookingReservation

The following routes are available for this service:
POST/bookingreservationsCreate 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.
"use strict";
export class CustomerBase {
    /** @param {{CustomerId?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string,SubscribedToNewsletter?:boolean,PersonalIdentityNumber?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {?string} */
    CustomerId;
    /** @type {string} */
    Firstname;
    /** @type {string} */
    Lastname;
    /** @type {string} */
    Email;
    /** @type {string} */
    Phone;
    /** @type {boolean} */
    SubscribedToNewsletter;
    /** @type {string} */
    PersonalIdentityNumber;
}
export class CustomerToHandle extends CustomerBase {
    /** @param {{CustomerId?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string,SubscribedToNewsletter?:boolean,PersonalIdentityNumber?:string}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
}
export class InvoiceAddressToHandle {
    /** @param {{CorporateIdentityNumber?:string,InvoiceAddress1?:string,InvoiceAddress2?:string,InvoiceCity?:string,InvoicePostalCode?:string,InvoiceCountryCode?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    CorporateIdentityNumber;
    /** @type {string} */
    InvoiceAddress1;
    /** @type {string} */
    InvoiceAddress2;
    /** @type {string} */
    InvoiceCity;
    /** @type {string} */
    InvoicePostalCode;
    /** @type {string} */
    InvoiceCountryCode;
}
export class ResourceToBook {
    /** @param {{ResourceTypeId?:number,ResourceId?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    ResourceTypeId;
    /** @type {number} */
    ResourceId;
}
export class ArticleToCreateBase {
    /** @param {{ArticleId?:number,Quantity?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    ArticleId;
    /** @type {number} */
    Quantity;
}
/** @typedef {'DefaultSetting'|'BookWithoutPayment'|'BookWithPaymentMessageToCustomer'|'BookWithManualPayment'} */
export var PaymentOptions;
(function (PaymentOptions) {
    PaymentOptions["DefaultSetting"] = "DefaultSetting"
    PaymentOptions["BookWithoutPayment"] = "BookWithoutPayment"
    PaymentOptions["BookWithPaymentMessageToCustomer"] = "BookWithPaymentMessageToCustomer"
    PaymentOptions["BookWithManualPayment"] = "BookWithManualPayment"
})(PaymentOptions || (PaymentOptions = {}));
export class AddCustomField {
    /** @param {{Id?:number,Value?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    Id;
    /** @type {string} */
    Value;
}
export class CreateBookingBase {
    /** @param {{CompanyId?:string,CustomerId?:string,PinCode?:string,Customer?:CustomerToHandle,InvoiceAddress?:InvoiceAddressToHandle,ServiceId?:number,BookedComments?:string,CommentsToCustomer?:string,Resources?:ResourceToBook[],RebateCodeIds?:number[],Articles?:ArticleToCreateBase[],SendEmailReminder?:boolean,SendSmsReminder?:boolean,SendSmsConfirmation?:boolean,SendEmailConfirmation?:boolean,PaymentOption?:PaymentOptions,CustomFields?:AddCustomField[],CustomerCustomFields?:AddCustomField[],AllowBookingOutsideSchedules?:boolean,TagIds?:number[]}} [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 {?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. */
    CustomerId;
    /**
     * @type {string}
     * @description If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here. */
    PinCode;
    /**
     * @type {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.  */
    Customer;
    /**
     * @type {InvoiceAddressToHandle}
     * @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.  */
    InvoiceAddress;
    /**
     * @type {number}
     * @description The service to be booked */
    ServiceId;
    /**
     * @type {string}
     * @description If you want to add comments to a booking you can add them here, this comments are never shared with the customer */
    BookedComments;
    /**
     * @type {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 */
    CommentsToCustomer;
    /** @type {ResourceToBook[]} */
    Resources = [];
    /**
     * @type {?number[]}
     * @description Rebate codes applied to booking */
    RebateCodeIds;
    /**
     * @type {ArticleToCreateBase[]}
     * @description Article ids that should be booked with the service. The articles must be of type ServiceAddonArticle and connected to the service. */
    Articles = [];
    /**
     * @type {?boolean}
     * @description If you want to send Email reminder */
    SendEmailReminder;
    /**
     * @type {?boolean}
     * @description If you want to send SMS reminder */
    SendSmsReminder;
    /**
     * @type {?boolean}
     * @description If you want to send SMS confirmation */
    SendSmsConfirmation;
    /**
     * @type {?boolean}
     * @description Only admins are allowed to not send an email confirmation. Default is true */
    SendEmailConfirmation;
    /**
     * @type {PaymentOptions}
     * @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). */
    PaymentOption;
    /**
     * @type {AddCustomField[]}
     * @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 */
    CustomFields = [];
    /**
     * @type {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 */
    CustomerCustomFields = [];
    /**
     * @type {boolean}
     * @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 */
    AllowBookingOutsideSchedules;
    /**
     * @type {number[]}
     * @description Ids of tags to attach to the booking at creation time. Tags must have Scope = Booking and belong to the company. */
    TagIds = [];
}
export class BookingReservationResponse {
    /** @param {{SessionKey?:string,CompanyId?:string,ServiceId?:number,From?:string,To?:string,StatusCode?:number,StatusName?:string,ExpirationDatetime?:string,NumberOfBookedSpots?:number,Price?:number,CurrencyId?:string,ResourceIds?:number[],SelectionPayload?:string,ResponseStatus?:ResponseStatus}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {string}
     * @description The opaque session key that identifies the reservation. */
    SessionKey;
    /**
     * @type {string}
     * @description The company id. */
    CompanyId;
    /**
     * @type {number}
     * @description The reserved service id. */
    ServiceId;
    /**
     * @type {string}
     * @description The reservation start. */
    From;
    /**
     * @type {string}
     * @description The reservation end. */
    To;
    /**
     * @type {number}
     * @description The BookingReservationStatus value. */
    StatusCode;
    /**
     * @type {string}
     * @description The BookingReservationStatus name. */
    StatusName;
    /**
     * @type {string}
     * @description When the hold expires (company-local time). */
    ExpirationDatetime;
    /**
     * @type {number}
     * @description Number of reserved spots. */
    NumberOfBookedSpots;
    /**
     * @type {?number}
     * @description The computed price of the reservation, if any. */
    Price;
    /**
     * @type {string}
     * @description The currency of the price, if any. */
    CurrencyId;
    /**
     * @type {number[]}
     * @description Ids of the resources held by the reservation. */
    ResourceIds = [];
    /**
     * @type {string}
     * @description The full in-progress selection payload (wizard/session state) as JSON. */
    SelectionPayload;
    /** @type {ResponseStatus} */
    ResponseStatus;
}
export class QuantityToBook {
    /** @param {{PriceId?:number,Quantity?:number,OccupiesSpot?:boolean}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @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) */
    PriceId;
    /**
     * @type {number}
     * @description Set the number of spots or resources you want to book on the specific price category */
    Quantity;
    /**
     * @type {boolean}
     * @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. */
    OccupiesSpot;
}
export class CreateBookingReservation extends CreateBookingBase {
    /** @param {{From?:string,To?:string,Quantities?:QuantityToBook[],CompanyId?:string,CustomerId?:string,PinCode?:string,Customer?:CustomerToHandle,InvoiceAddress?:InvoiceAddressToHandle,ServiceId?:number,BookedComments?:string,CommentsToCustomer?:string,Resources?:ResourceToBook[],RebateCodeIds?:number[],Articles?:ArticleToCreateBase[],SendEmailReminder?:boolean,SendSmsReminder?:boolean,SendSmsConfirmation?:boolean,SendEmailConfirmation?:boolean,PaymentOption?:PaymentOptions,CustomFields?:AddCustomField[],CustomerCustomFields?:AddCustomField[],AllowBookingOutsideSchedules?:boolean,TagIds?:number[]}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /**
     * @type {string}
     * @description The datetime you want to start the reservation. */
    From;
    /**
     * @type {string}
     * @description The datetime you want to end the reservation. */
    To;
    /**
     * @type {QuantityToBook[]}
     * @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. */
    Quantities = [];
}

JavaScript CreateBookingReservation 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 /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>