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 totrue
.
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 { Permissions, webMethod } from 'wix-web-module';2import { resources } from 'wix-bookings-backend';34export const myDeleteResource = webMethod(Permissions.Anyone, (resourceId) => {5 const options = { suppressAuth: true };6 return resources.deleteResource(resourceId, options)7 .then((deletedResource) => {8 return deletedResource;9 })10 .catch((error) => {11 return error;12 });13});1415// Resolves to a string containing the deleted resource ID.16// For example: "3f9215e0-7e96-417f-9c16-628e71c77311"