items
Returns an array of sessions that match the query.
Description
Type:
NAME
TYPE
DESCRIPTION
Session ID.
ID of the schedule that the session belongs to.
ID of the resource or service that the session's schedule belongs to.
Tags for the session. The value is inherited from the schedule and can be overridden unless the session is a recurring session.
Additional information about the session. Notes are not supported for recurring sessions.
Session status.
One of:
"CONFIRMED"
Default value."CANCELLED"
The session was deleted.
ID of the recurring session if this session is an instance of a recurrence. Use this ID to update the recurrence and all of the instances.
Session type.
One of:
"EVENT"
Reserved period of time on the schedule. For example, an appointment, class, course, or blocked time. Events are visible in the Dashboard in the Bookings app's Booking Calendar page."WORKING_HOURS"
Placeholder for available time on a resource’s schedule.
String representing a recurrence rule (RRULE) for a recurring session, as defined in iCalendar RFC 5545.
If the session is an instance of a recurrence pattern, the instanceOfRecurrence
property will contain the recurrence rule and this property will be empty.
The RRULE defines a rule for repeating a session.
Supported parameters are:
Keyword | Description | Supported values |
---|---|---|
FREQ | The frequency at which the session is recurs. Required. | WEEKLY |
INTERVAL | How often, in terms of FREQ , the session recurs. Default is 1. Optional. | |
UNTIL | The UTC end date and time of the recurrence. Optional. | |
BYDAY | Day of the week when the event should recur. Required. | One of: MO , TU , WE , TH , FR , SA , SU |
For example, a session that repeats every second week on a Monday until January 7, 2022 at 8 AM:
"FREQ=WEEKLY;INTERVAL=2;BYDAY=MO;UNTIL=20220107T080000Z"
String representing a recurrence rule (RRULE) if the session is an instance of a recurrence pattern.
Empty when the session is not an instance of a recurrence rule, or if the session defines a recurrence pattern, and recurrence
is not empty.
An object specifying the start date and time of the session. If the session is a recurring session, start
must contain a localDateTime
.
An object specifying the end date and time of the session. If the session is a recurring session, end
must contain a localDateTime
.
Was this helpful?
1import { sessions } from "wix-bookings-backend";23// ...4sessions.querySessions()5 .ge("end.timestamp", "2021-01-01T00:00:00.000Z")6 .lt("start.timestamp", "2021-05-01T00:00:00.000Z")7 .limit(3)8 .find()9 .then((results) => {10 if (results.items.length > 0) {11 const items = results.items; // see below12 } else {13 // handle case where no matching items found14 }15 })16 .catch((error) => {17 console.error(error);18 });192021 /* items:22 * [23 * {24 * "end": {25 * "localDateTime": {26 * "year": 2021,27 * "monthOfYear": 1,28 * "dayOfMonth": 1,29 * "hourOfDay": 11,30 * "minutesOfHour": 031 * },32 * "timestamp": "2021-01-01T09:00:00.000Z"33 * },34 * "_id": "193Z...gIR",35 * "instanceOfRecurrence": "FREQ=WEEKLY;INTERVAL=1;BYDAY=FR",36 * "notes": "",37 * "recurringSessionId": "53616b1f0c3c45a1b282675acd248179-44539bfb63ae496693109b6cb3a65a65",38 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",39 * "scheduleOwnerId": "b71df756-309f-468e-aec2-f82b9a9a9441",40 * "start": {41 * "localDateTime": {42 * "year": 2021,43 * "monthOfYear": 1,44 * "dayOfMonth": 1,45 * "hourOfDay": 10,46 * "minutesOfHour": 047 * },48 * "timestamp": "2021-01-01T08:00:00.000Z"49 * },50 * "status": "CONFIRMED",51 * "tags": [52 * "GROUP"53 * ],54 * "type": "EVENT"55 * },56 * {57 * "end": {58 * "localDateTime": {59 * "year": 2021,60 * "monthOfYear": 1,61 * "dayOfMonth": 4,62 * "hourOfDay": 18,63 * "minutesOfHour": 064 * },65 * "timestamp": "2021-01-04T16:00:00.000Z"66 * },67 * "_id": "4jO...deK",68 * "instanceOfRecurrence": "FREQ=WEEKLY;INTERVAL=1;BYDAY=FR",69 * "notes": "",70 * "recurringSessionId": "9299760d8a4a4f89b3481fc611f4be17-ecc4a5932acb4b7bb8c27c6ffb57fd49",71 * "scheduleId": "9299760d-8a4a-4f89-b348-1fc611f4be17",72 * "scheduleOwnerId": "e6b6108c-92bc-462b-937c-dab386909fd2",73 * "start": {74 * "localDateTime": {75 * "year": 2021,76 * "monthOfYear": 1,77 * "dayOfMonth": 4,78 * "hourOfDay": 10,79 * "minutesOfHour": 080 * },81 * "timestamp": "2021-01-04T08:00:00.000Z"82 * },83 * "status": "CONFIRMED",84 * "tags": [],85 * "type": "WORKING_HOURS"86 * },87 * {88 * "end": {89 * "localDateTime": {90 * "year": 2021,91 * "monthOfYear": 1,92 * "dayOfMonth": 6,93 * "hourOfDay": 18,94 * "minutesOfHour": 095 * },96 * "timestamp": "2021-01-06T16:00:00.000Z"97 * },98 * "_id": "4jO...Wwv",99 * "instanceOfRecurrence": "FREQ=WEEKLY;INTERVAL=1;BYDAY=FR",100 * "notes": "",101 * "recurringSessionId": "9299760d8a4a4f89b3481fc611f4be17-3d6b38529f544674a4976eca75e584ca",102 * "scheduleId": "9299760d-8a4a-4f89-b348-1fc611f4be17",103 * "scheduleOwnerId": "e6b6108c-92bc-462b-937c-dab386909fd2",104 * "start": {105 * "localDateTime": {106 * "year": 2021,107 * "monthOfYear": 1,108 * "dayOfMonth": 6,109 * "hourOfDay": 10,110 * "minutesOfHour": 0111 * },112 * "timestamp": "2021-01-06T08:00:00.000Z"113 * },114 * "status": "CONFIRMED",115 * "tags": [],116 * "type": "WORKING_HOURS"117 * }118 * ]119 */
1import { sessions } from "wix-bookings-backend";23// ...4sessions.querySessions()5 .ge("end.timestamp", "2021-01-01T00:00:00.000Z")6 .lt("start.timestamp", "2021-05-01T00:00:00.000Z")7 .eq("scheduleId", "aec380c0-ca2c-43c2-98f4-9aebbd3276f3")8 .ne("recurrence",null)9 .limit(5)10 .find()11 .then((results) => {12 if (results.items.length > 0) {13 const items = results.items; // see below14 } else {15 // handle case where no matching items found16 }17 })18 .catch((error) => {19 console.error(error);20 });212223 /*24 * items:25 * [26 * {27 *28 * "_id": "aec380c0ca2c43c298f49aebbd3276f3-7c4fc7d98139444bbbc93aed0ac7e8ca",29 * "notes": "",30 * "recurrence": "FREQ=WEEKLY;INTERVAL=1;BYDAY=WE;UNTIL=20220101T000000Z",31 * "scheduleId": "aec380c0-ca2c-43c2-98f4-9aebbd3276f3",32 * "scheduleOwnerId": "2a843db6-cb3f-4c96-90b8-f2f6e0055cae",33 * "start": {34 * "localDateTime": {35 * "year": 2021,36 * "monthOfYear": 3,37 * "dayOfMonth": 1,38 * "hourOfDay": 10,39 * "minutesOfHour": 040 * }41 * },42 * "end": {43 * "localDateTime": {44 * "year": 2021,45 * "monthOfYear": 3,46 * "dayOfMonth": 1,47 * "hourOfDay": 16,48 * "minutesOfHour": 049 * }50 * },51 * "status": "CONFIRMED",52 * "tags": [],53 * "type": "WORKING_HOURS"54 * },55 * {56 *57 * "_id": "aec380c0ca2c43c298f49aebbd3276f3-316ff0991aa2417aaed137e1c051d8c6",58 * "notes": "",59 * "recurrence": "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO;UNTIL=20220101T000000Z",60 * "scheduleId": "aec380c0-ca2c-43c2-98f4-9aebbd3276f3",61 * "scheduleOwnerId": "2a843db6-cb3f-4c96-90b8-f2f6e0055cae",62 * "start": {63 * "localDateTime": {64 * "year": 2021,65 * "monthOfYear": 3,66 * "dayOfMonth": 1,67 * "hourOfDay": 10,68 * "minutesOfHour": 069 * }70 * },71 * "end": {72 * "localDateTime": {73 * "year": 2021,74 * "monthOfYear": 3,75 * "dayOfMonth": 1,76 * "hourOfDay": 16,77 * "minutesOfHour": 078 * }79 * },80 * "status": "CONFIRMED",81 * "tags": [],82 * "type": "WORKING_HOURS"83 * }84 * ]85 */