Query Availability (SDK | REST) allows you to retrieve appointment slots and class events based on a query filter.
The filter
object in Query Availability is limited compared to other
Query methods in Wix APIs, requiring you to adhere to a specific format and
fewer supported comparison operators.
filter
supports only the implied equal operator, no other comparison operators
from the API Query Language
(SDK | REST)
are supported.
You're also limited in how you format the filter
object, compared to other
Query methods in Wix APIs.
Important:
You must specify filter
like this:
You must not use following format when specifying filter
:
The following table shows supported filter
fields.
Field | Required | Notes |
---|---|---|
startDate | Required | Returns appointment slots/class events that start at this time or later. Specify startDate in YYYY-MM-DDThh:mm:ss.sssZ format. |
endDate | Required | Returns appointment slots/class events that end at this time or earlier. Specify endDate in YYYY-MM-DDThh:mm:ss.sssZ format. |
serviceId | Required | |
resourceId | ||
timezone | Specifying timezone doesn't return only slots/events specified in the timezone. Instead, startDate and endDate filters are adjusted by the specified timezone. | |
bookable | Specifying {"bookable": true} returns only available slots/events. By default, both available and non-available slots are returned. | |
bookingPolicyViolations.tooEarlyToBook | By default, all slots/events are returned. Specifying {"tooEarlyToBook": false} returns only those that customers can already book, while specifying {"tooEarlyToBook": true} returns only those that can't be booked yet. | |
bookingPolicyViolations.tooLateToBook | By default, all slots/events are returned. Specifying {"tooLateToBook": false} returns only those that customers can still book, while specifying {"tooLateToBook": true} returns only those that can no longer be booked. | |
location.businessLocation.id | You can specify location.businessLocation.id more than once in the filter. Then, available slots/events are returned for all specified locations. | |
openSpots | Specifying openSpots returns only slots/events with at least the specified number of open spots. For appointment-based services, specifying any number greater than 1 returns no appointment slots at all. By default, all class events are returned, including those with zero open spots, while only appointment slots that are available (i.e., with at least 1 open spot) are returned. |
Currently, only sorting by startDate
is supported. You can sort both in
ascending and descending order.
Specify the sort
object like this.
If you retrieve both available and unavailable slots/events, all available slots/events appear first, followed by any unavailable slot/event.