Search.../

queryReservationLocations( )

Developer Preview

Creates a query to retrieve a list of reservation locations.

Description

The queryReservationLocations() function builds a query to retrieve a list of reservation locations and returns a ReservationLocationsQueryBuilder object.

The returned object contains the query definition, which is used to run the query using the find() function.

You can refine the query by chaining ReservationLocationsQueryBuilder functions onto the query. ReservationLocationsQueryBuilder functions enable you to filter, sort, and control the results that queryReservationLocations() returns.

queryReservationLocations() runs with the following ReservationLocationsQueryBuilder defaults, which you can override:

The following ReservationLocationsQueryBuilder functions are supported for queryReservationLocations(). For a full description of the reservation location object, see the object returned for the items property in ReservationLocationsQueryResult.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),in()

Syntax

function queryReservationLocations(options: QueryReservationLocationsOptions): ReservationLocationsQueryBuilder

queryReservationLocations Parameters

NAME
TYPE
DESCRIPTION
options
Optional
QueryReservationLocationsOptions

An object representing the available options for querying reservation locations.

Was this helpful?

Query all reservation locations (page code)

Copy Code
1import { reservationLocations } from 'wix-table-reservations-v2';
2
3reservationLocations.queryReservationLocations().find()
4 .then((retrievedReservationLocations) => {
5 const nextCursor = retrievedReservationLocations._nextCursor;
6 const minNotice = retrievedReservationLocations._items[0].configuration.onlineReservations.minimumReservationNotice;
7
8 console.log('Success! Retrieved reservation locations from query:', retrievedReservationLocations);
9 return retrievedReservationLocations;
10 })
11 .catch((error) => {
12 console.error(error);
13 // Handle the error
14 });
15
16/* Promise resolves to:
17 * {
18 * "_items": [
19 * {
20 * "location": {
21 * "name": "Yunitsman Street",
22 * "fax": "",
23 * "timeZone": "Europe/Dublin",
24 * "email": "",
25 * "phone": "",
26 * "address": {
27 * "formatted": "Yunitsman Street 5, Tel Aviv-Yafo, Israel",
28 * "location": {
29 * "latitude": 32.141816,
30 * "longitude": 34.7987383
31 * },
32 * "streetAddress": {
33 * "name": "Yunitsman Street",
34 * "number": "5",
35 * "apt": ""
36 * },
37 * "city": "Tel Aviv-Yafo",
38 * "subdivision": "",
39 * "country": "IL",
40 * "postalCode": ""
41 * },
42 * "businessSchedule": {
43 * "periods": [
44 * {
45 * "openDay": "SUNDAY",
46 * "openTime": "00:00",
47 * "closeDay": "MONDAY",
48 * "closeTime": "00:00"
49 * },
50 * {
51 * "openDay": "THURSDAY",
52 * "openTime": "00:00",
53 * "closeDay": "SUNDAY",
54 * "closeTime": "00:00"
55 * }
56 * ],
57 * "specialHourPeriod": []
58 * },
59 * "_id": "9bd42376-12c2-483e-86c3-8ee685e718e1"
60 * },
61 * "configuration": {
62 * "onlineReservations": {
63 * "partiesSize": {
64 * "min": 1,
65 * "max": 6
66 * },
67 * "minimumReservationNotice": {
68 * "number": 15,
69 * "unit": "MINUTES"
70 * },
71 * "turnoverTimeRules": [],
72 * "turnoverRules": [],
73 * "onlineReservationsEnabled": true
74 * },
75 * "myReservationsFields": []
76 * },
77 * "default": false,
78 * "archived": false,
79 * "_id": "800c581a-1942-4079-8198-2eee44463eb7"
80 * },
81 * {
82 * "location": {
83 * "name": "Nemal Tel Aviv Street",
84 * "fax": "",
85 * "timeZone": "Europe/Dublin",
86 * "email": "",
87 * "phone": "",
88 * "address": {
89 * "formatted": "Tel Aviv Port, Nemal Tel Aviv Street, Tel Aviv, Israel",
90 * "location": {
91 * "latitude": 32.0972612,
92 * "longitude": 34.77376549999999
93 * },
94 * "streetAddress": {
95 * "name": "Nemal Tel Aviv Street",
96 * "number": "",
97 * "apt": ""
98 * },
99 * "city": "Tel Aviv-Yafo",
100 * "country": "IL"
101 * },
102 * "businessSchedule": {
103 * "periods": [
104 * {
105 * "openDay": "SUNDAY",
106 * "openTime": "00:00",
107 * "closeDay": "MONDAY",
108 * "closeTime": "00:00"
109 * },
110 * {
111 * "openDay": "THURSDAY",
112 * "openTime": "00:00",
113 * "closeDay": "SUNDAY",
114 * "closeTime": "00:00"
115 * }
116 * ],
117 * "specialHourPeriod": []
118 * },
119 * "_id": "f1f59093-6842-45a4-b9d1-106429ec8313"
120 * },
121 * "configuration": {
122 * "onlineReservations": {
123 * "partiesSize": {
124 * "min": 1,
125 * "max": 6
126 * },
127 * "minimumReservationNotice": {
128 * "number": 15,
129 * "unit": "MINUTES"
130 * },
131 * "turnoverTimeRules": [],
132 * "turnoverRules": [],
133 * "businessSchedule": {
134 * "periods": [
135 * {
136 * "openDay": "SUNDAY",
137 * "openTime": "00:00",
138 * "closeDay": "TUESDAY",
139 * "closeTime": "00:00"
140 * },
141 * {
142 * "openDay": "WEDNESDAY",
143 * "openTime": "00:00",
144 * "closeDay": "THURSDAY",
145 * "closeTime": "00:00"
146 * },
147 * {
148 * "openDay": "FRIDAY",
149 * "openTime": "00:00",
150 * "closeDay": "SUNDAY",
151 * "closeTime": "00:00"
152 * }
153 * ],
154 * "specialHourPeriod": []
155 * },
156 * "onlineReservationsEnabled": true
157 * },
158 * "reservationForm": {
159 * "customFieldDefinitions": [
160 * {
161 * "name": "Allergies",
162 * "required": false,
163 * "_id": "f4283b2d-6340-4cf9-bae7-8769e6b62127"
164 * }
165 * ]
166 * },
167 * "myReservationsFields": []
168 * },
169 * "default": true,
170 * "archived": false,
171 * "_id": "fab8cc1f-31cf-462f-b5bb-392594624bf2"
172 * }
173 * ],
174 * "_originQuery": {
175 * "filterTree": {
176 * "$and": []
177 * },
178 * "invalidArguments": [],
179 * "encoder": {},
180 * "transformationPaths": {},
181 * "sort": [],
182 * "paging": {},
183 * "pagingMethod": "CURSOR",
184 * "builderOptions": {
185 * "cursorWithEmptyFilterAndSort": true
186 * }
187 * },
188 * "_limit": 50,
189 * "_nextCursor": "",
190 * "_prevCursor": "",
191 * "cursors": {
192 * "next": "",
193 * "prev": ""
194 * }
195 * }
196 */
197
198
Query all reservation locations with options (backend)

This example demonstrates how to request the FULL fieldset in options using elevation to get the necessary permissions.

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { reservationLocations } from 'wix-table-reservations.v2';
3import { elevate } from 'wix-auth';
4
5/* Sample options value:
6 * {
7 * "fieldsets": ["FULL"]
8 * }
9 */
10
11export const myQueryReservationLocationsFunction = webMethod(Permissions.Anyone, async (options) => {
12 const elevatedQueryReservationLocations = elevate(reservationLocations.QueryReservationLocations);
13
14 try {
15 const retrievedReservationLocations = await elevatedQueryReservationLocations(options).find();
16
17 const nextCursor = retrievedReservationLocations._nextCursor;
18 const minNotice = retrievedReservationLocations._items[0].configuration.onlineReservations.minimumReservationNotice;
19
20 return retrievedReservationLocations;
21 } catch (error) {
22 console.error(error);
23 // Handle the error
24 }
25});
26
27/* Promise resolves to:
28 * {
29 * "_items": [
30 * {
31 * "revision": "30",
32 * "location": {
33 * "name": "Yunitsman Street",
34 * "fax": "",
35 * "timeZone": "Europe/Dublin",
36 * "email": "",
37 * "phone": "",
38 * "address": {
39 * "formatted": "Yunitsman Street 5, Tel Aviv-Yafo, Israel",
40 * "location": {
41 * "latitude": 32.141816,
42 * "longitude": 34.7987383
43 * },
44 * "streetAddress": {
45 * "name": "Yunitsman Street",
46 * "number": "5",
47 * "apt": ""
48 * },
49 * "city": "Tel Aviv-Yafo",
50 * "subdivision": "",
51 * "country": "IL",
52 * "postalCode": ""
53 * },
54 * "businessSchedule": {
55 * "periods": [
56 * {
57 * "openDay": "SUNDAY",
58 * "openTime": "00:00",
59 * "closeDay": "MONDAY",
60 * "closeTime": "00:00"
61 * },
62 * {
63 * "openDay": "THURSDAY",
64 * "openTime": "00:00",
65 * "closeDay": "SUNDAY",
66 * "closeTime": "00:00"
67 * }
68 * ],
69 * "specialHourPeriod": []
70 * },
71 * "_id": "9bd42376-12c2-483e-86c3-8ee685e718e1"
72 * },
73 * "configuration": {
74 * "onlineReservations": {
75 * "partiesSize": {
76 * "min": 1,
77 * "max": 6
78 * },
79 * "partySize": {
80 * "min": 1,
81 * "max": 6
82 * },
83 * "minimumReservationNotice": {
84 * "number": 20,
85 * "unit": "MINUTES"
86 * },
87 * "defaultTurnoverTime": 90,
88 * "turnoverTimeRules": [],
89 * "turnoverRules": [],
90 * "onlineReservationsEnabled": true
91 * },
92 * "reservationForm": {
93 * "customFieldDefinitions": []
94 * },
95 * "myReservationsFields": [
96 * {
97 * "fieldType": "TABLE",
98 * "shown": true
99 * },
100 * {
101 * "fieldType": "START_DATE",
102 * "shown": true
103 * },
104 * {
105 * "fieldType": "END_DATE",
106 * "shown": true
107 * },
108 * {
109 * "fieldType": "CREATED_DATE",
110 * "shown": true
111 * },
112 * {
113 * "fieldType": "UPDATED_DATE",
114 * "shown": true
115 * },
116 * {
117 * "fieldType": "PARTY_SIZE",
118 * "shown": true
119 * },
120 * {
121 * "fieldType": "FIRST_NAME",
122 * "shown": true
123 * },
124 * {
125 * "fieldType": "LAST_NAME",
126 * "shown": true
127 * },
128 * {
129 * "fieldType": "EMAIL",
130 * "shown": true
131 * },
132 * {
133 * "fieldType": "PHONE",
134 * "shown": true
135 * },
136 * {
137 * "fieldType": "ADDITIONAL_INFO",
138 * "shown": true
139 * },
140 * {
141 * "fieldType": "TEAM_MESSAGE",
142 * "shown": true
143 * },
144 * {
145 * "fieldType": "STATUS",
146 * "shown": true
147 * }
148 * ],
149 * "tableManagement": {
150 * "tableDefinitions": [
151 * {
152 * "name": "Small table",
153 * "seatsMin": 1,
154 * "seatsMax": 4,
155 * "isActive": true,
156 * "_id": "ec4adfb0-568f-4846-8f92-86059ef94ec8"
157 * },
158 * {
159 * "name": "Big table",
160 * "seatsMin": 3,
161 * "seatsMax": 6,
162 * "isActive": true,
163 * "_id": "63b73378-5e79-401c-9a69-3e4da76558d3"
164 * }
165 * ],
166 * "deletedTableDefinitions": [],
167 * "tableCombinations": []
168 * }
169 * },
170 * "default": false,
171 * "archived": false,
172 * "_id": "800c581a-1942-4079-8198-2eee44463eb7",
173 * "_createdDate": "2023-10-08T07:07:39.123Z",
174 * "_updatedDate": "2024-01-17T12:56:25.112Z"
175 * },
176 * {
177 * "revision": "39",
178 * "location": {
179 * "name": "Nemal Tel Aviv Street",
180 * "fax": "",
181 * "timeZone": "Europe/Dublin",
182 * "email": "",
183 * "phone": "",
184 * "address": {
185 * "formatted": "Tel Aviv Port, Nemal Tel Aviv Street, Tel Aviv, Israel",
186 * "location": {
187 * "latitude": 32.0972612,
188 * "longitude": 34.77376549999999
189 * },
190 * "streetAddress": {
191 * "name": "Nemal Tel Aviv Street",
192 * "number": "",
193 * "apt": ""
194 * },
195 * "city": "Tel Aviv-Yafo",
196 * "country": "IL"
197 * },
198 * "businessSchedule": {
199 * "periods": [
200 * {
201 * "openDay": "SUNDAY",
202 * "openTime": "00:00",
203 * "closeDay": "MONDAY",
204 * "closeTime": "00:00"
205 * },
206 * {
207 * "openDay": "THURSDAY",
208 * "openTime": "00:00",
209 * "closeDay": "SUNDAY",
210 * "closeTime": "00:00"
211 * }
212 * ],
213 * "specialHourPeriod": []
214 * },
215 * "_id": "f1f59093-6842-45a4-b9d1-106429ec8313"
216 * },
217 * "configuration": {
218 * "onlineReservations": {
219 * "seatPacing": {
220 * "number": 11,
221 * "enabled": false
222 * },
223 * "partyPacing": {
224 * "number": 6,
225 * "enabled": true
226 * },
227 * "partiesSize": {
228 * "min": 1,
229 * "max": 6
230 * },
231 * "partySize": {
232 * "min": 1,
233 * "max": 6
234 * },
235 * "minimumReservationNotice": {
236 * "number": 20,
237 * "unit": "MINUTES"
238 * },
239 * "defaultTurnoverTime": 90,
240 * "turnoverTimeRules": [],
241 * "turnoverRules": [],
242 * "businessSchedule": {
243 * "periods": [
244 * {
245 * "openDay": "SUNDAY",
246 * "openTime": "00:00",
247 * "closeDay": "TUESDAY",
248 * "closeTime": "00:00"
249 * },
250 * {
251 * "openDay": "WEDNESDAY",
252 * "openTime": "00:00",
253 * "closeDay": "THURSDAY",
254 * "closeTime": "00:00"
255 * },
256 * {
257 * "openDay": "FRIDAY",
258 * "openTime": "00:00",
259 * "closeDay": "SUNDAY",
260 * "closeTime": "00:00"
261 * }
262 * ],
263 * "specialHourPeriod": []
264 * },
265 * "onlineReservationsEnabled": true
266 * },
267 * "reservationForm": {
268 * "customFieldDefinitions": [
269 * {
270 * "name": "Allergies",
271 * "required": false,
272 * "_id": "f4283b2d-6340-4cf9-bae7-8769e6b62127"
273 * }
274 * ]
275 * },
276 * "myReservationsFields": [
277 * {
278 * "fieldType": "TABLE",
279 * "shown": true
280 * },
281 * {
282 * "fieldType": "START_DATE",
283 * "shown": true
284 * },
285 * {
286 * "fieldType": "END_DATE",
287 * "shown": true
288 * },
289 * {
290 * "fieldType": "CREATED_DATE",
291 * "shown": true
292 * },
293 * {
294 * "fieldType": "UPDATED_DATE",
295 * "shown": true
296 * },
297 * {
298 * "fieldType": "PARTY_SIZE",
299 * "shown": true
300 * },
301 * {
302 * "fieldType": "FIRST_NAME",
303 * "shown": true
304 * },
305 * {
306 * "fieldType": "LAST_NAME",
307 * "shown": true
308 * },
309 * {
310 * "fieldType": "EMAIL",
311 * "shown": true
312 * },
313 * {
314 * "fieldType": "PHONE",
315 * "shown": true
316 * },
317 * {
318 * "fieldType": "ADDITIONAL_INFO",
319 * "shown": true
320 * },
321 * {
322 * "fieldType": "TEAM_MESSAGE",
323 * "shown": true
324 * },
325 * {
326 * "fieldType": "STATUS",
327 * "shown": true
328 * },
329 * {
330 * "fieldType": "CUSTOM_FIELD",
331 * "customFieldId": "f4283b2d-6340-4cf9-bae7-8769e6b62127",
332 * "shown": false
333 * }
334 * ],
335 * "tableManagement": {
336 * "tableDefinitions": [
337 * {
338 * "name": "Small table",
339 * "seatsMin": 1,
340 * "seatsMax": 4,
341 * "isActive": true,
342 * "_id": "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
343 * },
344 * {
345 * "name": "Big table",
346 * "seatsMin": 3,
347 * "seatsMax": 6,
348 * "isActive": true,
349 * "_id": "2c8aed3a-20c5-404c-b075-84a92f90a996"
350 * }
351 * ],
352 * "deletedTableDefinitions": [],
353 * "tableCombinations": [
354 * {
355 * "tableIds": [
356 * "1ed802ae-708f-4da6-9177-54c3df5d3dd5",
357 * "2c8aed3a-20c5-404c-b075-84a92f90a996"
358 * ],
359 * "seatsMin": 7,
360 * "seatsMax": 10,
361 * "isActive": true,
362 * "_id": "6df9a875-d30d-4c0f-9faa-0a5ae18cd6f6"
363 * }
364 * ]
365 * }
366 * },
367 * "default": true,
368 * "archived": false,
369 * "_id": "fab8cc1f-31cf-462f-b5bb-392594624bf2",
370 * "_createdDate": "2023-07-10T09:06:07.507Z",
371 * "_updatedDate": "2024-01-17T12:56:26.047Z"
372 * }
373 * ],
374 * "_originQuery": {
375 * "filterTree": {
376 * "$and": []
377 * },
378 * "invalidArguments": [],
379 * "encoder": {},
380 * "transformationPaths": {},
381 * "sort": [],
382 * "paging": {},
383 * "pagingMethod": "CURSOR",
384 * "builderOptions": {
385 * "cursorWithEmptyFilterAndSort": true
386 * }
387 * },
388 * "_limit": 50,
389 * "_nextCursor": "",
390 * "_prevCursor": "",
391 * "cursors": {
392 * "next": "",
393 * "prev": ""
394 * }
395 * }
396 */
397