BokaMera.API.Host

<back to all web services

DeleteResource

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
DELETE/resource/{Id}Delete a resourceDelete a resource for the currently logged in user, only administrators are allowed to delete resources.
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 TimeException(ITimeException):
    # @ApiMember(Description="Time exception id")
    id: int = 0
    """
    Time exception id
    """


    # @ApiMember(Description="Indicates whether or not the time exception is recurring")
    is_recurring: bool = False
    """
    Indicates whether or not the time exception is recurring
    """


    # @ApiMember(Description="Indicates whether the time exception is blocking the time or not")
    is_block: bool = False
    """
    Indicates whether the time exception is blocking the time or not
    """


    # @ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
    reason_text: Optional[str] = None
    """
    The reason of the time exception, example: Vacation, doctors appointment, ...
    """


    # @ApiMember(Description="The public reason of the time exception, example: Vacation, doctors appointment, ...")
    reason_text_public: Optional[str] = None
    """
    The public reason of the time exception, example: Vacation, doctors appointment, ...
    """


    # @ApiMember(Description="Time exception start")
    from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1))
    """
    Time exception start
    """


    # @ApiMember(Description="Time exception end")
    to: datetime.datetime = datetime.datetime(1, 1, 1)
    """
    Time exception end
    """


    # @ApiMember(Description="Resources that owns this exception")
    resource_ids: Optional[List[int]] = None
    """
    Resources that owns this exception
    """


class BookingStatusEnum(IntEnum):
    BOOKED = 1
    UNBOOKED = 2
    RESERVED = 3
    CANCELED = 4
    AWAITING_PAYMENT = 5
    AWAITING_PAYMENT_NO_TIME_LIMIT = 6
    PAYED = 7
    AWAITING_PAYMENT_REQUEST_FROM_ADMIN = 8
    AWAITING_PAYMENT_FROM_PROVIDER = 9
    INVOICED = 10


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BookedCustomer:
    id: Optional[str] = None
    firstname: Optional[str] = None
    lastname: Optional[str] = None
    email: Optional[str] = None
    phone: Optional[str] = None
    facebook_user_name: Optional[str] = None
    image_url: Optional[str] = None
    corporate_identity_number: Optional[str] = None
    invoice_address1: Optional[str] = None
    invoice_address2: Optional[str] = None
    invoice_city: Optional[str] = None
    invoice_postal_code: Optional[str] = None
    invoice_country_code: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BookedTime(IBookedTime):
    # @ApiMember(Description="Booking id")
    id: int = 0
    """
    Booking id
    """


    # @ApiMember(Description="The booked service")
    service_id: int = 0
    """
    The booked service
    """


    # @ApiMember(Description="Booking start")
    from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1))
    """
    Booking start
    """


    # @ApiMember(Description="Booking end")
    to: datetime.datetime = datetime.datetime(1, 1, 1)
    """
    Booking end
    """


    # @ApiMember(Description="Number of booked spots")
    booked_spots: int = 0
    """
    Number of booked spots
    """


    # @ApiMember(Description="Number of total spots for the service")
    total_spots: int = 0
    """
    Number of total spots for the service
    """


    # @ApiMember(Description="The pause after the booking")
    pause_after_in_minutes: int = 0
    """
    The pause after the booking
    """


    # @ApiMember(Description="The booking status")
    status_id: int = 0
    """
    The booking status
    """


    status: Optional[BookingStatusEnum] = None
    # @ApiMember(Description="The customer the booking belongs to")
    customer: Optional[BookedCustomer] = None
    """
    The customer the booking belongs to
    """


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


    # @ApiMember(Description="The resource name")
    name: Optional[str] = None
    """
    The resource name
    """


    # @ApiMember(Description="The resource description")
    description: Optional[str] = None
    """
    The resource description
    """


    # @ApiMember(Description="If resource is active or not")
    active: bool = False
    """
    If resource is active or not
    """


    # @ApiMember(Description="The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.")
    color: Optional[str] = None
    """
    The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.
    """


    # @ApiMember(Description="The email of the resource")
    email: Optional[str] = None
    """
    The email of the resource
    """


    # @ApiMember(Description="The image url of the resource")
    image_url: Optional[str] = None
    """
    The image url of the resource
    """


    # @ApiMember(Description="The mobile phone number of the resource")
    mobile_phone: Optional[str] = None
    """
    The mobile phone number of the resource
    """


    # @ApiMember(Description="Used by example code locks to know what access group the resource is assigned to")
    access_group: Optional[str] = None
    """
    Used by example code locks to know what access group the resource is assigned to
    """


    # @ApiMember(Description="If the resource should receive email notification when booked")
    email_notification: bool = False
    """
    If the resource should receive email notification when booked
    """


    # @ApiMember(Description="If the resource should receive SMS notification when booked")
    sms_notification: bool = False
    """
    If the resource should receive SMS notification when booked
    """


    # @ApiMember(Description="If the resource should receive email reminders on bookings")
    send_email_reminder: Optional[bool] = None
    """
    If the resource should receive email reminders on bookings
    """


    # @ApiMember(Description="If the resource should receive SMS reminders on bookings")
    send_s_m_s_reminder: Optional[bool] = None
    """
    If the resource should receive SMS reminders on bookings
    """


    # @ApiMember(Description="The resource time exceptions")
    exceptions: Optional[List[TimeException]] = None
    """
    The resource time exceptions
    """


    # @ApiMember(Description="The resource bookings")
    bookings: Optional[List[BookedTime]] = None
    """
    The resource bookings
    """


    # @ApiMember(Description="Then date when the resource was created")
    created: datetime.datetime = datetime.datetime(1, 1, 1)
    """
    Then date when the resource was created
    """


    # @ApiMember(Description="Then date when the resource was updated")
    updated: datetime.datetime = datetime.datetime(1, 1, 1)
    """
    Then date when the resource was updated
    """


    response_status: Optional[ResponseStatus] = None


# @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
# @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
# @ApiResponse(Description="Bookings exists that needs to be unbooked before creating this time exceptions, use the /timeexceptions/collidingevents to find which bookings and use the booking service to unbook them", StatusCode=409)
# @ValidateRequest(Validator="IsAuthenticated")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DeleteResource(ICompany):
    # @ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)
    company_id: Optional[str] = None
    """
    Enter the company id, if blank company id and you are an admin, your company id will be used.
    """


    # @ApiMember(Description="Id of the resource to delete", IsRequired=true)
    id: int = 0
    """
    Id of the resource to delete
    """


    # @ApiMember(Description="If this equals true it will force to set the resource as active = false, this is used when bookings exists on the resource and it can't be deleted. ")
    force: bool = False
    """
    If this equals true it will force to set the resource as active = false, this is used when bookings exists on the resource and it can't be deleted. 
    """

Python DeleteResource 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.

DELETE /resource/{Id} HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	Name: String,
	Description: String,
	Active: False,
	Color: String,
	Email: String,
	MobilePhone: String,
	AccessGroup: String,
	EmailNotification: False,
	SMSNotification: False,
	SendEmailReminder: False,
	SendSMSReminder: False,
	Exceptions: 
	[
		{
			Id: 0,
			IsRecurring: False,
			IsBlock: False,
			ReasonText: String,
			ReasonTextPublic: String,
			ResourceIds: 
			[
				0
			]
		}
	],
	Bookings: 
	[
		{
			Id: 0,
			ServiceId: 0,
			BookedSpots: 0,
			TotalSpots: 0,
			PauseAfterInMinutes: 0,
			StatusId: 0,
			Status: Booked,
			Customer: 
			{
				Firstname: String,
				Lastname: String,
				Email: String,
				Phone: String,
				FacebookUserName: String,
				ImageUrl: String,
				CorporateIdentityNumber: String,
				InvoiceAddress1: String,
				InvoiceAddress2: String,
				InvoiceCity: String,
				InvoicePostalCode: String,
				InvoiceCountryCode: String
			}
		}
	],
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}