createResource( )


Creates a resource.

The createResource() function returns a Promise that resolves to the created resource.

Bookings resources are created with a schedule. The schedule and its sessions determine the resource's availability. Note that the schedule must contain a start date in the availability.start property. For resources that are available during the business's default hours, add the business's schedule as a linked schedule in the resource's schedule. For resources that have their own hours, create sessions with type "WORKING_HOURS" using the resource's schedule. You can use both individual and recurring sessions to define resource availability. You cannot use availability constraints for resource schedules.

When creating a resource using createResource(), include the resource's schedule information. Set the schedule information as follows:

  • If the resource uses the default business hours, get the business resource's schedule ID and include it in the scheduleInfo.availability.linkedSchedules array in the scheduleInfo parameter. The default hours can bee found in the Dashboard under Settings in the Bookings section, on the Appointment hours page.
  • If the resource has its own custom working hours, create the resource, then create sessions of type "WORKING_HOURS" using the createSession() function. Use the scheduleId returned from createResource() when creating the sessions. These session can be single sessions or recurring sessions.
  • You can have both default business hours and custom hours for the same resource schedule by combining the steps above.

Notes:

  • The Wix Bookings app does not show both default business hours and custom hours on the Staff page in the dashboard. If you've set up both custom and default business hours, only the default business hours will appear in the app, although both are working.
  • The Wix Bookings app does not show non-recurring WORKING_HOURS sessions in the resource calendar.
  • You can only add the business resource's schedule as a linked schedule for a resource.
  • A resource can have one schedule only.
  • You can have up to 135 active resources and an additional 135 deleted resources.
  • Only users with the Bookings Admin role can create a resource. You can override the role permissions by setting the options.suppressAuth parameter to true.

Notes:

  • A resource can have one schedule only.
  • You can have up to 135 active resources and an additional 135 deleted resources.
Method Declaration
Copy
Method Parameters
resourceInfoResourceInfoRequired

Information to use when creating a resource.


scheduleInfoArray<ResourceScheduleInfo>Required

List of schedules to be assigned to the created resource. Currently only a single schedule is allowed. If provided, any additional schedules in the resource object will be ignored.


optionsOptions

An object representing the available options for creating a resource.

Returns
Return Type:Promise<Resource>
Was this helpful?
Yes
No