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.
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using BokaMera.API.ServiceModel.Dtos;
using BokaMera.API.ServiceModel.Dtos.Commons;
using BokaMera.API.ServiceModel.Enums;

namespace BokaMera.API.ServiceModel.Dtos
{
    public partial class AddCustomField
    {
        public virtual int Id { get; set; }
        public virtual string Value { get; set; }
    }

    public partial class ArticleToCreateBase
    {
        public virtual int ArticleId { get; set; }
        public virtual int Quantity { get; set; }
    }

    public partial class BookingReservationResponse
    {
        ///<summary>
        ///The opaque session key that identifies the reservation.
        ///</summary>
        [ApiMember(Description="The opaque session key that identifies the reservation.")]
        public virtual Guid SessionKey { get; set; }

        ///<summary>
        ///The company id.
        ///</summary>
        [ApiMember(Description="The company id.")]
        public virtual Guid CompanyId { get; set; }

        ///<summary>
        ///The reserved service id.
        ///</summary>
        [ApiMember(Description="The reserved service id.")]
        public virtual int ServiceId { get; set; }

        ///<summary>
        ///The reservation start.
        ///</summary>
        [ApiMember(Description="The reservation start.")]
        public virtual DateTime From { get; set; }

        ///<summary>
        ///The reservation end.
        ///</summary>
        [ApiMember(Description="The reservation end.")]
        public virtual DateTime To { get; set; }

        ///<summary>
        ///The BookingReservationStatus value.
        ///</summary>
        [ApiMember(Description="The BookingReservationStatus value.")]
        public virtual int StatusCode { get; set; }

        ///<summary>
        ///The BookingReservationStatus name.
        ///</summary>
        [ApiMember(Description="The BookingReservationStatus name.")]
        public virtual string StatusName { get; set; }

        ///<summary>
        ///When the hold expires (company-local time).
        ///</summary>
        [ApiMember(Description="When the hold expires (company-local time).")]
        public virtual DateTime ExpirationDatetime { get; set; }

        ///<summary>
        ///Number of reserved spots.
        ///</summary>
        [ApiMember(Description="Number of reserved spots.")]
        public virtual int NumberOfBookedSpots { get; set; }

        ///<summary>
        ///The computed price of the reservation, if any.
        ///</summary>
        [ApiMember(Description="The computed price of the reservation, if any.")]
        public virtual decimal? Price { get; set; }

        ///<summary>
        ///The currency of the price, if any.
        ///</summary>
        [ApiMember(Description="The currency of the price, if any.")]
        public virtual string CurrencyId { get; set; }

        ///<summary>
        ///Ids of the resources held by the reservation.
        ///</summary>
        [ApiMember(Description="Ids of the resources held by the reservation.")]
        public virtual List<int> ResourceIds { 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.")]
        public virtual string SelectionPayload { get; set; }

        public virtual ResponseStatus ResponseStatus { get; set; }
    }

    [ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)]
    [ApiResponse(Description="The selected slot is no longer available", StatusCode=409)]
    public partial class CreateBookingReservation
        : CreateBookingBase, IInterval
    {
        ///<summary>
        ///The datetime you want to start the reservation.
        ///</summary>
        [ApiMember(Description="The datetime you want to start the reservation.", IsRequired=true)]
        public virtual DateTime From { get; set; }

        ///<summary>
        ///The datetime you want to end the reservation.
        ///</summary>
        [ApiMember(Description="The datetime you want to end the reservation.", IsRequired=true)]
        public virtual DateTime To { 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.")]
        public virtual QuantityToBook[] Quantities { get; set; } = [];
    }

    public partial class CustomerToHandle
        : CustomerBase
    {
    }

    public partial class InvoiceAddressToHandle
        : IInvoiceAddress
    {
        public virtual string CorporateIdentityNumber { get; set; }
        public virtual string InvoiceAddress1 { get; set; }
        public virtual string InvoiceAddress2 { get; set; }
        public virtual string InvoiceCity { get; set; }
        public virtual string InvoicePostalCode { get; set; }
        public virtual string InvoiceCountryCode { get; set; }
    }

    public partial class 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)]
        public virtual int PriceId { 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)]
        public virtual int Quantity { 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.")]
        public virtual bool OccupiesSpot { get; set; }
    }

    public partial class ResourceToBook
    {
        public virtual int ResourceTypeId { get; set; }
        public virtual int ResourceId { get; set; }
    }

}

namespace BokaMera.API.ServiceModel.Dtos.Commons
{
    public partial class CreateBookingBase
        : ICreateBookingBase
    {
        ///<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.")]
        public virtual Guid? CompanyId { 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.")]
        public virtual Guid? CustomerId { 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.")]
        public virtual string PinCode { 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. ")]
        public virtual CustomerToHandle Customer { 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. ")]
        public virtual InvoiceAddressToHandle InvoiceAddress { get; set; }

        ///<summary>
        ///The service to be booked
        ///</summary>
        [ApiMember(Description="The service to be booked", IsRequired=true)]
        public virtual int ServiceId { 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")]
        public virtual string BookedComments { 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")]
        public virtual string CommentsToCustomer { get; set; }

        public virtual List<ResourceToBook> Resources { get; set; } = [];
        ///<summary>
        ///Rebate codes applied to booking
        ///</summary>
        [ApiMember(Description="Rebate codes applied to booking")]
        public virtual List<int>? RebateCodeIds { 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)]
        public virtual ArticleToCreateBase[] Articles { get; set; } = [];

        ///<summary>
        ///If you want to send Email reminder
        ///</summary>
        [ApiMember(Description="If you want to send Email reminder")]
        public virtual bool? SendEmailReminder { get; set; }

        ///<summary>
        ///If you want to send SMS reminder
        ///</summary>
        [ApiMember(Description="If you want to send SMS reminder")]
        public virtual bool? SendSmsReminder { get; set; }

        ///<summary>
        ///If you want to send SMS confirmation
        ///</summary>
        [ApiMember(Description="If you want to send SMS confirmation")]
        public virtual bool? SendSmsConfirmation { 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")]
        public virtual bool? SendEmailConfirmation { 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).")]
        public virtual PaymentOptions PaymentOption { 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")]
        public virtual List<AddCustomField> CustomFields { 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")]
        public virtual List<AddCustomField> CustomerCustomFields { 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")]
        public virtual bool AllowBookingOutsideSchedules { 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.")]
        public virtual List<int> TagIds { get; set; } = [];
    }

    public partial class CustomerBase
        : ICustomerBase
    {
        public virtual Guid? CustomerId { get; set; }
        public virtual string Firstname { get; set; }
        public virtual string Lastname { get; set; }
        public virtual string Email { get; set; }
        public virtual string Phone { get; set; }
        public virtual bool SubscribedToNewsletter { get; set; }
        public virtual string PersonalIdentityNumber { get; set; }
    }

}

namespace BokaMera.API.ServiceModel.Enums
{
    public enum PaymentOptions
    {
        DefaultSetting,
        BookWithoutPayment,
        BookWithPaymentMessageToCustomer,
        BookWithManualPayment,
    }

}

C# CreateBookingReservation DTOs

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

HTTP + OTHER

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: text/jsonl
Content-Type: text/jsonl
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: text/jsonl
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"}}}