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.
namespace BokaMera.API.ServiceModel.Dtos

open System
open System.IO
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations

    [<AllowNullLiteral>]
    type BookingReservationResponse() = 
        ///<summary>
        ///The opaque session key that identifies the reservation.
        ///</summary>
        [<ApiMember(Description="The opaque session key that identifies the reservation.")>]
        member val SessionKey:Guid = new Guid() with get,set

        ///<summary>
        ///The company id.
        ///</summary>
        [<ApiMember(Description="The company id.")>]
        member val CompanyId:Guid = new Guid() with get,set

        ///<summary>
        ///The reserved service id.
        ///</summary>
        [<ApiMember(Description="The reserved service id.")>]
        member val ServiceId:Int32 = new Int32() with get,set

        ///<summary>
        ///The reservation start.
        ///</summary>
        [<ApiMember(Description="The reservation start.")>]
        member val From:DateTime = new DateTime() with get,set

        ///<summary>
        ///The reservation end.
        ///</summary>
        [<ApiMember(Description="The reservation end.")>]
        member val To:DateTime = new DateTime() with get,set

        ///<summary>
        ///The BookingReservationStatus value.
        ///</summary>
        [<ApiMember(Description="The BookingReservationStatus value.")>]
        member val StatusCode:Int32 = new Int32() with get,set

        ///<summary>
        ///The BookingReservationStatus name.
        ///</summary>
        [<ApiMember(Description="The BookingReservationStatus name.")>]
        member val StatusName:String = null with get,set

        ///<summary>
        ///When the hold expires (company-local time).
        ///</summary>
        [<ApiMember(Description="When the hold expires (company-local time).")>]
        member val ExpirationDatetime:DateTime = new DateTime() with get,set

        ///<summary>
        ///Number of reserved spots.
        ///</summary>
        [<ApiMember(Description="Number of reserved spots.")>]
        member val NumberOfBookedSpots:Int32 = new Int32() with get,set

        ///<summary>
        ///The computed price of the reservation, if any.
        ///</summary>
        [<ApiMember(Description="The computed price of the reservation, if any.")>]
        member val Price:Nullable<Decimal> = new Nullable<Decimal>() with get,set

        ///<summary>
        ///The currency of the price, if any.
        ///</summary>
        [<ApiMember(Description="The currency of the price, if any.")>]
        member val CurrencyId:String = null with get,set

        ///<summary>
        ///Ids of the resources held by the reservation.
        ///</summary>
        [<ApiMember(Description="Ids of the resources held by the reservation.")>]
        member val ResourceIds:ResizeArray<Int32> = null with get,set

        ///<summary>
        ///The full in-progress selection payload (wizard/session state) as JSON.
        ///</summary>
        [<ApiMember(Description="The full in-progress selection payload (wizard/session state) as JSON.")>]
        member val SelectionPayload:String = null with get,set

        member val ResponseStatus:ResponseStatus = null with get,set

    [<AllowNullLiteral>]
    type CustomerBase() = 
        member val CustomerId:Nullable<Guid> = new Nullable<Guid>() with get,set
        member val Firstname:String = null with get,set
        member val Lastname:String = null with get,set
        member val Email:String = null with get,set
        member val Phone:String = null with get,set
        member val SubscribedToNewsletter:Boolean = new Boolean() with get,set
        member val PersonalIdentityNumber:String = null with get,set

    [<AllowNullLiteral>]
    type CustomerToHandle() = 
        inherit CustomerBase()

    [<AllowNullLiteral>]
    type InvoiceAddressToHandle() = 
        member val CorporateIdentityNumber:String = null with get,set
        member val InvoiceAddress1:String = null with get,set
        member val InvoiceAddress2:String = null with get,set
        member val InvoiceCity:String = null with get,set
        member val InvoicePostalCode:String = null with get,set
        member val InvoiceCountryCode:String = null with get,set

    [<AllowNullLiteral>]
    type ResourceToBook() = 
        member val ResourceTypeId:Int32 = new Int32() with get,set
        member val ResourceId:Int32 = new Int32() with get,set

    [<AllowNullLiteral>]
    type ArticleToCreateBase() = 
        member val ArticleId:Int32 = new Int32() with get,set
        member val Quantity:Int32 = new Int32() with get,set

    type PaymentOptions =
        | DefaultSetting = 0
        | BookWithoutPayment = 1
        | BookWithPaymentMessageToCustomer = 2
        | BookWithManualPayment = 3

    [<AllowNullLiteral>]
    type AddCustomField() = 
        member val Id:Int32 = new Int32() with get,set
        member val Value:String = null with get,set

    [<AllowNullLiteral>]
    type CreateBookingBase() = 
        ///<summary>
        ///The company id, if empty will use the company id for the user you are logged in with.
        ///</summary>
        [<ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")>]
        member val CompanyId:Nullable<Guid> = new Nullable<Guid>() with get,set

        ///<summary>
        ///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.
        ///</summary>
        [<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.")>]
        member val CustomerId:Nullable<Guid> = new Nullable<Guid>() with get,set

        ///<summary>
        ///If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here.
        ///</summary>
        [<ApiMember(Description="If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here.")>]
        member val PinCode:String = null with get,set

        ///<summary>
        ///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. 
        ///</summary>
        [<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. ")>]
        member val Customer:CustomerToHandle = null with get,set

        ///<summary>
        ///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. 
        ///</summary>
        [<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. ")>]
        member val InvoiceAddress:InvoiceAddressToHandle = null with get,set

        ///<summary>
        ///The service to be booked
        ///</summary>
        [<ApiMember(Description="The service to be booked", IsRequired=true)>]
        member val ServiceId:Int32 = new Int32() with get,set

        ///<summary>
        ///If you want to add comments to a booking you can add them here, this comments are never shared with the customer
        ///</summary>
        [<ApiMember(Description="If you want to add comments to a booking you can add them here, this comments are never shared with the customer")>]
        member val BookedComments:String = null with get,set

        ///<summary>
        ///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
        ///</summary>
        [<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")>]
        member val CommentsToCustomer:String = null with get,set

        member val Resources:ResizeArray<ResourceToBook> = null with get,set
        ///<summary>
        ///Rebate codes applied to booking
        ///</summary>
        [<ApiMember(Description="Rebate codes applied to booking")>]
        member val RebateCodeIds:ResizeArray<Int32> = null with get,set

        ///<summary>
        ///Article ids that should be booked with the service. The articles must be of type ServiceAddonArticle and connected to the service.
        ///</summary>
        [<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)>]
        member val Articles:ArticleToCreateBase[] = null with get,set

        ///<summary>
        ///If you want to send Email reminder
        ///</summary>
        [<ApiMember(Description="If you want to send Email reminder")>]
        member val SendEmailReminder:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///If you want to send SMS reminder
        ///</summary>
        [<ApiMember(Description="If you want to send SMS reminder")>]
        member val SendSmsReminder:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///If you want to send SMS confirmation
        ///</summary>
        [<ApiMember(Description="If you want to send SMS confirmation")>]
        member val SendSmsConfirmation:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///Only admins are allowed to not send an email confirmation. Default is true
        ///</summary>
        [<ApiMember(Description="Only admins are allowed to not send an email confirmation. Default is true")>]
        member val SendEmailConfirmation:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///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).
        ///</summary>
        [<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).")>]
        member val PaymentOption:PaymentOptions = new PaymentOptions() with get,set

        ///<summary>
        ///If Custom Fields are added to the booking, here you will send the id and the value for each custom field to be saved
        ///</summary>
        [<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")>]
        member val CustomFields:ResizeArray<AddCustomField> = null with get,set

        ///<summary>
        ///If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated
        ///</summary>
        [<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")>]
        member val CustomerCustomFields:ResizeArray<AddCustomField> = null with get,set

        ///<summary>
        ///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
        ///</summary>
        [<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")>]
        member val AllowBookingOutsideSchedules:Boolean = new Boolean() with get,set

        ///<summary>
        ///Ids of tags to attach to the booking at creation time. Tags must have Scope = Booking and belong to the company.
        ///</summary>
        [<ApiMember(Description="Ids of tags to attach to the booking at creation time. Tags must have Scope = Booking and belong to the company.")>]
        member val TagIds:ResizeArray<Int32> = null with get,set

    [<AllowNullLiteral>]
    type QuantityToBook() = 
        ///<summary>
        ///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)
        ///</summary>
        [<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)>]
        member val PriceId:Int32 = new Int32() with get,set

        ///<summary>
        ///Set the number of spots or resources you want to book on the specific price category
        ///</summary>
        [<ApiMember(Description="Set the number of spots or resources you want to book on the specific price category", IsRequired=true)>]
        member val Quantity:Int32 = new Int32() with get,set

        ///<summary>
        ///If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.
        ///</summary>
        [<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.")>]
        member val OccupiesSpot:Boolean = new Boolean() with get,set

    [<ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)>]
    [<ApiResponse(Description="The selected slot is no longer available", StatusCode=409)>]
    [<AllowNullLiteral>]
    type CreateBookingReservation() = 
        inherit CreateBookingBase()
        ///<summary>
        ///The datetime you want to start the reservation.
        ///</summary>
        [<ApiMember(Description="The datetime you want to start the reservation.", IsRequired=true)>]
        member val From:DateTime = new DateTime() with get,set

        ///<summary>
        ///The datetime you want to end the reservation.
        ///</summary>
        [<ApiMember(Description="The datetime you want to end the reservation.", IsRequired=true)>]
        member val To:DateTime = new DateTime() with get,set

        ///<summary>
        ///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.
        ///</summary>
        [<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.")>]
        member val Quantities:QuantityToBook[] = null with get,set

F# CreateBookingReservation DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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/json
Content-Type: application/json
Content-Length: length

{"Quantities":[{"PriceId":0,"Quantity":0,"OccupiesSpot":false}],"CompanyId":"00000000-0000-0000-0000-000000000000","CustomerId":"00000000-0000-0000-0000-000000000000","PinCode":"String","Customer":{"CustomerId":"00000000-0000-0000-0000-000000000000","Firstname":"String","Lastname":"String","Email":"String","Phone":"String","SubscribedToNewsletter":false,"PersonalIdentityNumber":"String"},"InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"},"ServiceId":0,"BookedComments":"String","CommentsToCustomer":"String","Resources":[{"ResourceTypeId":0,"ResourceId":0}],"RebateCodeIds":[0],"Articles":[{"ArticleId":0,"Quantity":0}],"SendEmailReminder":false,"SendSmsReminder":false,"SendSmsConfirmation":false,"SendEmailConfirmation":false,"PaymentOption":"DefaultSetting","CustomFields":[{"Id":0,"Value":"String"}],"CustomerCustomFields":[{"Id":0,"Value":"String"}],"AllowBookingOutsideSchedules":false,"TagIds":[0]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ServiceId":0,"StatusCode":0,"StatusName":"String","NumberOfBookedSpots":0,"Price":0,"CurrencyId":"String","ResourceIds":[0],"SelectionPayload":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}