getServiceAvailability( )


Gets the available slots for a specific service.

The getServiceAvailability() function returns a Promise that resolves to a list of slots from the given service that have open spots, and can therefore still be booked. If the service is offered in multiple locations, a slot is returned for each location.

Note: location in the slot object is not yet available to all users.

Service availability means different things for the different service types:

  • Appointments: See here to understand what affects the availability of an appointment. An appointment is returned as available if it meets the conditions outlined in the article linked above and the appointment slot's time falls within the time specified by the AvailabilityOptions or within the default time frame if no options are specified.
  • Classes: A class slot is returned as available if the slot's time falls within the time specified by the AvailabilityOptions or within the default time frame if no options are specified.
  • Courses: The first session slot from a set of course sessions is returned as available if the first course slot's time falls within the time specified by the AvailabilityOptions or within the default time frame if no options are specified.

To understand how getServiceAvailability() is used in a typical booking lifecycle, see Typical Booking Lifecycle.

The passed serviceId must be an ID from your site's Bookings/Services collection. Typically, you retrieve the ID from from the collection using a query or through a dataset.

Optionally, you can pass an AvailabilityOptions object that defines a date range for which slots should be returned. If you do not pass an an AvailabilityOptions object, the default date range is from the date and time the function is called until one week later.

Method Declaration
Copy
Method Parameters
serviceIdstringRequired

The ID of the service for which to check slot availability.


optionsAvailabilityOptions

Options that refine which slots should be returned.

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