| 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. |
|---|
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
@ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="The selected slot is no longer available", StatusCode=409)
open class CreateBookingReservation : CreateBookingBase(), IInterval
{
/**
* The datetime you want to start the reservation.
*/
@ApiMember(Description="The datetime you want to start the reservation.", IsRequired=true)
override var From:Date? = null
/**
* The datetime you want to end the reservation.
*/
@ApiMember(Description="The datetime you want to end the reservation.", IsRequired=true)
override var To:Date? = null
/**
* 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.")
open var Quantities:ArrayList<QuantityToBook> = ArrayList<QuantityToBook>()
}
open class CreateBookingBase : ICreateBookingBase
{
/**
* 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.")
override var CompanyId:UUID? = null
/**
* 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.")
override var CustomerId:UUID? = null
/**
* 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.")
override var PinCode:String? = null
/**
* 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. ")
override var Customer:CustomerToHandle? = null
/**
* 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. ")
override var InvoiceAddress:InvoiceAddressToHandle? = null
/**
* The service to be booked
*/
@ApiMember(Description="The service to be booked", IsRequired=true)
override var ServiceId:Int? = null
/**
* 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")
override var BookedComments:String? = null
/**
* 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")
override var CommentsToCustomer:String? = null
override var Resources:ArrayList<ResourceToBook> = ArrayList<ResourceToBook>()
/**
* Rebate codes applied to booking
*/
@ApiMember(Description="Rebate codes applied to booking")
override var RebateCodeIds:ArrayList<Int>? = null
/**
* 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)
open var Articles:ArrayList<ArticleToCreateBase> = ArrayList<ArticleToCreateBase>()
/**
* If you want to send Email reminder
*/
@ApiMember(Description="If you want to send Email reminder")
override var SendEmailReminder:Boolean? = null
/**
* If you want to send SMS reminder
*/
@ApiMember(Description="If you want to send SMS reminder")
override var SendSmsReminder:Boolean? = null
/**
* If you want to send SMS confirmation
*/
@ApiMember(Description="If you want to send SMS confirmation")
override var SendSmsConfirmation:Boolean? = null
/**
* 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")
override var SendEmailConfirmation:Boolean? = null
/**
* 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).")
override var PaymentOption:PaymentOptions? = null
/**
* 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")
override var CustomFields:ArrayList<AddCustomField> = ArrayList<AddCustomField>()
/**
* 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")
override var CustomerCustomFields:ArrayList<AddCustomField> = ArrayList<AddCustomField>()
/**
* 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")
override var AllowBookingOutsideSchedules:Boolean? = null
/**
* 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.")
open var TagIds:ArrayList<Int> = ArrayList<Int>()
}
open class CustomerToHandle : CustomerBase()
{
}
open class CustomerBase : ICustomerBase
{
override var CustomerId:UUID? = null
override var Firstname:String? = null
override var Lastname:String? = null
override var Email:String? = null
override var Phone:String? = null
override var SubscribedToNewsletter:Boolean? = null
override var PersonalIdentityNumber:String? = null
}
open class InvoiceAddressToHandle : IInvoiceAddress
{
override var CorporateIdentityNumber:String? = null
override var InvoiceAddress1:String? = null
override var InvoiceAddress2:String? = null
override var InvoiceCity:String? = null
override var InvoicePostalCode:String? = null
override var InvoiceCountryCode:String? = null
}
open class ResourceToBook
{
open var ResourceTypeId:Int? = null
open var ResourceId:Int? = null
}
open class ArticleToCreateBase
{
open var ArticleId:Int? = null
open var Quantity:Int? = null
}
enum class PaymentOptions
{
DefaultSetting,
BookWithoutPayment,
BookWithPaymentMessageToCustomer,
BookWithManualPayment,
}
open class AddCustomField
{
open var Id:Int? = null
open var Value:String? = null
}
open class QuantityToBook
{
/**
* 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)
open var PriceId:Int? = null
/**
* 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)
open var Quantity:Int? = null
/**
* 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.")
open var OccupiesSpot:Boolean? = null
}
open class BookingReservationResponse
{
/**
* The opaque session key that identifies the reservation.
*/
@ApiMember(Description="The opaque session key that identifies the reservation.")
open var SessionKey:UUID? = null
/**
* The company id.
*/
@ApiMember(Description="The company id.")
open var CompanyId:UUID? = null
/**
* The reserved service id.
*/
@ApiMember(Description="The reserved service id.")
open var ServiceId:Int? = null
/**
* The reservation start.
*/
@ApiMember(Description="The reservation start.")
open var From:Date? = null
/**
* The reservation end.
*/
@ApiMember(Description="The reservation end.")
open var To:Date? = null
/**
* The BookingReservationStatus value.
*/
@ApiMember(Description="The BookingReservationStatus value.")
open var StatusCode:Int? = null
/**
* The BookingReservationStatus name.
*/
@ApiMember(Description="The BookingReservationStatus name.")
open var StatusName:String? = null
/**
* When the hold expires (company-local time).
*/
@ApiMember(Description="When the hold expires (company-local time).")
open var ExpirationDatetime:Date? = null
/**
* Number of reserved spots.
*/
@ApiMember(Description="Number of reserved spots.")
open var NumberOfBookedSpots:Int? = null
/**
* The computed price of the reservation, if any.
*/
@ApiMember(Description="The computed price of the reservation, if any.")
open var Price:BigDecimal? = null
/**
* The currency of the price, if any.
*/
@ApiMember(Description="The currency of the price, if any.")
open var CurrencyId:String? = null
/**
* Ids of the resources held by the reservation.
*/
@ApiMember(Description="Ids of the resources held by the reservation.")
open var ResourceIds:ArrayList<Int> = ArrayList<Int>()
/**
* The full in-progress selection payload (wizard/session state) as JSON.
*/
@ApiMember(Description="The full in-progress selection payload (wizard/session state) as JSON.")
open var SelectionPayload:String? = null
open var ResponseStatus:ResponseStatus? = null
}
Kotlin 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>