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

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

    [<AllowNullLiteral>]
    type TimeException() = 
        ///<summary>
        ///Time exception id
        ///</summary>
        [<ApiMember(Description="Time exception id")>]
        member val Id:Int32 = new Int32() with get,set

        ///<summary>
        ///Indicates whether or not the time exception is recurring
        ///</summary>
        [<ApiMember(Description="Indicates whether or not the time exception is recurring")>]
        member val IsRecurring:Boolean = new Boolean() with get,set

        ///<summary>
        ///Indicates whether the time exception is blocking the time or not
        ///</summary>
        [<ApiMember(Description="Indicates whether the time exception is blocking the time or not")>]
        member val IsBlock:Boolean = new Boolean() with get,set

        ///<summary>
        ///The reason of the time exception, example: Vacation, doctors appointment, ...
        ///</summary>
        [<ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")>]
        member val ReasonText:String = null with get,set

        ///<summary>
        ///The public reason of the time exception, example: Vacation, doctors appointment, ...
        ///</summary>
        [<ApiMember(Description="The public reason of the time exception, example: Vacation, doctors appointment, ...")>]
        member val ReasonTextPublic:String = null with get,set

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

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

        ///<summary>
        ///Resources that owns this exception
        ///</summary>
        [<ApiMember(Description="Resources that owns this exception")>]
        member val ResourceIds:Int32[] = [||] with get,set

    type BookingStatusEnum =
        | Booked = 1
        | Unbooked = 2
        | Reserved = 3
        | Canceled = 4
        | AwaitingPayment = 5
        | AwaitingPaymentNoTimeLimit = 6
        | Payed = 7
        | AwaitingPaymentRequestFromAdmin = 8
        | AwaitingPaymentFromProvider = 9
        | Invoiced = 10

    [<AllowNullLiteral>]
    type BookedCustomer() = 
        member val Id:Guid = new 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 FacebookUserName:String = null with get,set
        member val ImageUrl:String = null with get,set
        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 BookedTime() = 
        ///<summary>
        ///Booking id
        ///</summary>
        [<ApiMember(Description="Booking id")>]
        member val Id:Int32 = new Int32() with get,set

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

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

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

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

        ///<summary>
        ///Number of total spots for the service
        ///</summary>
        [<ApiMember(Description="Number of total spots for the service")>]
        member val TotalSpots:Int32 = new Int32() with get,set

        ///<summary>
        ///The pause after the booking
        ///</summary>
        [<ApiMember(Description="The pause after the booking")>]
        member val PauseAfterInMinutes:Int32 = new Int32() with get,set

        ///<summary>
        ///The booking status
        ///</summary>
        [<ApiMember(Description="The booking status")>]
        member val StatusId:Int32 = new Int32() with get,set

        member val Status:BookingStatusEnum = new BookingStatusEnum() with get,set
        ///<summary>
        ///The customer the booking belongs to
        ///</summary>
        [<ApiMember(Description="The customer the booking belongs to")>]
        member val Customer:BookedCustomer = null with get,set

    [<AllowNullLiteral>]
    type ResourceQueryResponse() = 
        ///<summary>
        ///The resource id
        ///</summary>
        [<ApiMember(Description="The resource id")>]
        member val Id:Int32 = new Int32() with get,set

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

        ///<summary>
        ///The resource description
        ///</summary>
        [<ApiMember(Description="The resource description")>]
        member val Description:String = null with get,set

        ///<summary>
        ///If resource is active or not
        ///</summary>
        [<ApiMember(Description="If resource is active or not")>]
        member val Active:Boolean = new Boolean() with get,set

        ///<summary>
        ///The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.
        ///</summary>
        [<ApiMember(Description="The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.")>]
        member val Color:String = null with get,set

        ///<summary>
        ///The email of the resource
        ///</summary>
        [<ApiMember(Description="The email of the resource")>]
        member val Email:String = null with get,set

        ///<summary>
        ///The image url of the resource
        ///</summary>
        [<ApiMember(Description="The image url of the resource")>]
        member val ImageUrl:Uri = null with get,set

        ///<summary>
        ///The mobile phone number of the resource
        ///</summary>
        [<ApiMember(Description="The mobile phone number of the resource")>]
        member val MobilePhone:String = null with get,set

        ///<summary>
        ///Used by example code locks to know what access group the resource is assigned to
        ///</summary>
        [<ApiMember(Description="Used by example code locks to know what access group the resource is assigned to")>]
        member val AccessGroup:String = null with get,set

        ///<summary>
        ///If the resource should receive email notification when booked
        ///</summary>
        [<ApiMember(Description="If the resource should receive email notification when booked")>]
        member val EmailNotification:Boolean = new Boolean() with get,set

        ///<summary>
        ///If the resource should receive SMS notification when booked
        ///</summary>
        [<ApiMember(Description="If the resource should receive SMS notification when booked")>]
        member val SMSNotification:Boolean = new Boolean() with get,set

        ///<summary>
        ///If the resource should receive email reminders on bookings
        ///</summary>
        [<ApiMember(Description="If the resource should receive email reminders on bookings")>]
        member val SendEmailReminder:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///If the resource should receive SMS reminders on bookings
        ///</summary>
        [<ApiMember(Description="If the resource should receive SMS reminders on bookings")>]
        member val SendSMSReminder:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///The resource time exceptions
        ///</summary>
        [<ApiMember(Description="The resource time exceptions")>]
        member val Exceptions:ResizeArray<TimeException> = new ResizeArray<TimeException>() with get,set

        ///<summary>
        ///The resource bookings
        ///</summary>
        [<ApiMember(Description="The resource bookings")>]
        member val Bookings:ResizeArray<BookedTime> = new ResizeArray<BookedTime>() with get,set

        ///<summary>
        ///Then date when the resource was created
        ///</summary>
        [<ApiMember(Description="Then date when the resource was created")>]
        member val Created:DateTime = new DateTime() with get,set

        ///<summary>
        ///Then date when the resource was updated
        ///</summary>
        [<ApiMember(Description="Then date when the resource was updated")>]
        member val Updated:DateTime = new DateTime() with get,set

        member val ResponseStatus:ResponseStatus = null with get,set

    [<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")>]
    [<AllowNullLiteral>]
    type DeleteResource() = 
        ///<summary>
        ///Enter the company id, if blank company id and you are an admin, your company id will be used.
        ///</summary>
        [<ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)>]
        member val CompanyId:Nullable<Guid> = new Nullable<Guid>() with get,set

        ///<summary>
        ///Id of the resource to delete
        ///</summary>
        [<ApiMember(Description="Id of the resource to delete", IsRequired=true)>]
        member val Id:Int32 = new Int32() with get,set

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

F# 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
		}
	}
}