Search.../

deleteResource( )

Deletes a resource.

Description

The deleteResource() function returns a Promise that is resolved when a resource is deleted. Deleting a resource updates its status to "DELETED".

You cannot delete a resource if it has booked sessions.

Notes:

  • The Bookings app automatically creates a resource with a name and tag of value "business". This resource is used for the business's schedule and working hours and cannot be deleted.
  • You can have up to 135 active resources and an additional 135 deleted resources.
  • Only users with the Bookings Admin role can delete a resource. You can override the role permissions by setting the options.suppressAuth parameter to true.

Syntax

function deleteResource(resourceId: string, [options: Options]): Promise<string>

deleteResource Parameters

NAME
TYPE
DESCRIPTION
resourceId
string

ID of the resource to delete.

options
Optional
Options

An object representing the available options for deleting a resource.

Returns

Fulfilled - ID of the deleted resource.

Return Type:

Promise<string>

Was this helpful?

Delete a resource

Copy Code
1import { resources } from "wix-bookings-backend";
2
3export function myDeleteResource(resourceId) {
4 const options = { suppressAuth: true };
5 return resources.deleteResource(resourceId, options)
6 .then((deletedResource) => {
7 return deletedResource;
8 })
9 .catch((error) => {
10 return error;
11 });
12}
13
14 // Resolves to a string containing the deleted resource ID.
15 // For example: "3f9215e0-7e96-417f-9c16-628e71c77311"