getServiceAvailability( )


Gets the available slots for a specific service.

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

Service availability means different things for the different service types (SDK | Velo):

  • 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 (SDK | Velo).

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

Optionally, you can specify an AvailabilityOptions object that defines a date range for which slots should be returned. If you do not specify an AvailabilityOptions object, the default date range is from the date and time the method 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>
JavaScript
Did this help?