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.

export class TimeException implements ITimeException
{
    /** @description Time exception id */
    // @ApiMember(Description="Time exception id")
    public Id: number;

    /** @description Indicates whether or not the time exception is recurring */
    // @ApiMember(Description="Indicates whether or not the time exception is recurring")
    public IsRecurring: boolean;

    /** @description Indicates whether the time exception is blocking the time or not */
    // @ApiMember(Description="Indicates whether the time exception is blocking the time or not")
    public IsBlock: boolean;

    /** @description The reason of the time exception, example: Vacation, doctors appointment, ... */
    // @ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
    public ReasonText: string;

    /** @description The public reason of the time exception, example: Vacation, doctors appointment, ... */
    // @ApiMember(Description="The public reason of the time exception, example: Vacation, doctors appointment, ...")
    public ReasonTextPublic: string;

    /** @description Time exception start */
    // @ApiMember(Description="Time exception start")
    public From: string;

    /** @description Time exception end */
    // @ApiMember(Description="Time exception end")
    public To: string;

    /** @description Resources that owns this exception */
    // @ApiMember(Description="Resources that owns this exception")
    public ResourceIds: number[];

    public constructor(init?: Partial<TimeException>) { (Object as any).assign(this, init); }
}

export enum BookingStatusEnum
{
    Booked = 1,
    Unbooked = 2,
    Reserved = 3,
    Canceled = 4,
    AwaitingPayment = 5,
    AwaitingPaymentNoTimeLimit = 6,
    Payed = 7,
    AwaitingPaymentRequestFromAdmin = 8,
    AwaitingPaymentFromProvider = 9,
    Invoiced = 10,
}

export class BookedCustomer
{
    public Id: string;
    public Firstname: string;
    public Lastname: string;
    public Email: string;
    public Phone: string;
    public FacebookUserName: string;
    public ImageUrl: string;
    public CorporateIdentityNumber: string;
    public InvoiceAddress1: string;
    public InvoiceAddress2: string;
    public InvoiceCity: string;
    public InvoicePostalCode: string;
    public InvoiceCountryCode: string;

    public constructor(init?: Partial<BookedCustomer>) { (Object as any).assign(this, init); }
}

export class BookedTime implements IBookedTime
{
    /** @description Booking id */
    // @ApiMember(Description="Booking id")
    public Id: number;

    /** @description The booked service */
    // @ApiMember(Description="The booked service")
    public ServiceId: number;

    /** @description Booking start */
    // @ApiMember(Description="Booking start")
    public From: string;

    /** @description Booking end */
    // @ApiMember(Description="Booking end")
    public To: string;

    /** @description Number of booked spots */
    // @ApiMember(Description="Number of booked spots")
    public BookedSpots: number;

    /** @description Number of total spots for the service */
    // @ApiMember(Description="Number of total spots for the service")
    public TotalSpots: number;

    /** @description The pause after the booking */
    // @ApiMember(Description="The pause after the booking")
    public PauseAfterInMinutes: number;

    /** @description The booking status */
    // @ApiMember(Description="The booking status")
    public StatusId: number;

    public Status: BookingStatusEnum;
    /** @description The customer the booking belongs to */
    // @ApiMember(Description="The customer the booking belongs to")
    public Customer: BookedCustomer;

    public constructor(init?: Partial<BookedTime>) { (Object as any).assign(this, init); }
}

export class ResourceQueryResponse
{
    /** @description The resource id */
    // @ApiMember(Description="The resource id")
    public Id: number;

    /** @description The resource name */
    // @ApiMember(Description="The resource name")
    public Name: string;

    /** @description The resource description */
    // @ApiMember(Description="The resource description")
    public Description: string;

    /** @description If resource is active or not */
    // @ApiMember(Description="If resource is active or not")
    public Active: boolean;

    /** @description The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue. */
    // @ApiMember(Description="The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.")
    public Color: string;

    /** @description The email of the resource */
    // @ApiMember(Description="The email of the resource")
    public Email: string;

    /** @description The image url of the resource */
    // @ApiMember(Description="The image url of the resource")
    public ImageUrl: string;

    /** @description The mobile phone number of the resource */
    // @ApiMember(Description="The mobile phone number of the resource")
    public MobilePhone: string;

    /** @description Used by example code locks to know what access group the resource is assigned to */
    // @ApiMember(Description="Used by example code locks to know what access group the resource is assigned to")
    public AccessGroup: string;

    /** @description If the resource should receive email notification when booked */
    // @ApiMember(Description="If the resource should receive email notification when booked")
    public EmailNotification: boolean;

    /** @description If the resource should receive SMS notification when booked */
    // @ApiMember(Description="If the resource should receive SMS notification when booked")
    public SMSNotification: boolean;

    /** @description If the resource should receive email reminders on bookings */
    // @ApiMember(Description="If the resource should receive email reminders on bookings")
    public SendEmailReminder?: boolean;

    /** @description If the resource should receive SMS reminders on bookings */
    // @ApiMember(Description="If the resource should receive SMS reminders on bookings")
    public SendSMSReminder?: boolean;

    /** @description The resource time exceptions */
    // @ApiMember(Description="The resource time exceptions")
    public Exceptions: TimeException[];

    /** @description The resource bookings */
    // @ApiMember(Description="The resource bookings")
    public Bookings: BookedTime[];

    /** @description Then date when the resource was created */
    // @ApiMember(Description="Then date when the resource was created")
    public Created: string;

    /** @description Then date when the resource was updated */
    // @ApiMember(Description="Then date when the resource was updated")
    public Updated: string;

    public ResponseStatus: ResponseStatus;

    public constructor(init?: Partial<ResourceQueryResponse>) { (Object as any).assign(this, init); }
}

// @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")
export class DeleteResource implements ICompany
{
    /** @description Enter the company id, if blank company id and you are an admin, your company id will be used. */
    // @ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)
    public CompanyId: string;

    /** @description Id of the resource to delete */
    // @ApiMember(Description="Id of the resource to delete", IsRequired=true)
    public Id: number;

    /** @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.  */
    // @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. ")
    public Force: boolean;

    public constructor(init?: Partial<DeleteResource>) { (Object as any).assign(this, init); }
}

TypeScript 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
		}
	}
}