BokaMera.API.Host

<back to all web services

UpdateAllQuantities

Requires Authentication
The following routes are available for this service:
PUT/bookings/{BookingId}/quantity/Update all quantities on a booking. Note: all quantity needs to be added, all existing quantities on the booking will be deletedUpdate all quantities on a booking. You will need to provide all quantities in this call to be added/updated. Note: all quantity needs to be added, all existing quantities on the booking will be deleted.
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BookedQuantity:
    # @ApiMember(Description="The quantity Id")
    id: int = 0
    """
    The quantity Id
    """


    # @ApiMember(Description="The quantity for booked on this price category")
    quantity: int = 0
    """
    The quantity for booked on this price category
    """


    # @ApiMember(Description="The price")
    price: Optional[float] = None
    """
    The price
    """


    # @ApiMember(Description="The price bofore rebate codes")
    price_before_rebate: Optional[float] = None
    """
    The price bofore rebate codes
    """


    # @ApiMember(Description="The price currency")
    currency_id: Optional[str] = None
    """
    The price currency
    """


    # @ApiMember(Description="The price sign")
    price_sign: Optional[str] = None
    """
    The price sign
    """


    # @ApiMember(Description="The price category")
    category: Optional[str] = None
    """
    The price category
    """


    # @ApiMember(Description="The price VAT in percent")
    vat: Optional[Decimal] = None
    """
    The price VAT in percent
    """


    # @ApiMember(Description="The price text to display")
    price_text: Optional[str] = None
    """
    The price text to display
    """


    # @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.")
    occupies_spot: bool = False
    """
    If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.
    """


# @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
# @ApiResponse(Description="You have too low privileges to call this service", StatusCode=403)
# @ValidateRequest(Validator="IsAuthenticated")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UpdateAllQuantities(ICompany):
    # @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
    company_id: Optional[str] = None
    """
    The company id, if empty will use the company id for the user you are logged in with.
    """


    # @ApiMember(Description="Id of the booking", IsRequired=true, ParameterType="path")
    booking_id: int = 0
    """
    Id of the booking
    """


    # @ApiMember(Description="Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot.")
    quantities: Optional[List[QuantityToUpdate]] = None
    """
    Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot.
    """


    # @ApiMember(Description="Any comments to be stored in the event log.")
    comments: Optional[str] = None
    """
    Any comments to be stored in the event log.
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class QuantityToUpdate:
    # @ApiMember(Description="Id of the quantity", IsRequired=true)
    id: Optional[int] = None
    """
    Id of the quantity
    """


    # @ApiMember(Description="The quantity for booked on this price category", IsRequired=true)
    quantity: Optional[int] = None
    """
    The quantity for booked on this price category
    """


    # @ApiMember(Description="The price")
    price: Optional[float] = None
    """
    The price
    """


    # @ApiMember(Description="The price currency")
    currency_id: Optional[str] = None
    """
    The price currency
    """


    # @ApiMember(Description="The price category")
    category: Optional[str] = None
    """
    The price category
    """


    # @ApiMember(Description="The price VAT in percent")
    vat: Optional[Decimal] = None
    """
    The price VAT in percent
    """


    # @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.")
    occupies_spot: Optional[bool] = None
    """
    If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.
    """

Python UpdateAllQuantities DTOs

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

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

PUT /bookings/{BookingId}/quantity/ HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	BookingId: 0,
	Quantities: 
	[
		{
			Id: 0,
			Quantity: 0,
			Price: 0,
			CurrencyId: String,
			Category: String,
			VAT: 0,
			OccupiesSpot: False
		}
	],
	Comments: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	Quantity: 0,
	Price: 0,
	PriceBeforeRebate: 0,
	CurrencyId: String,
	PriceSign: String,
	Category: String,
	VAT: 0,
	PriceText: String,
	OccupiesSpot: False
}