queryLocations( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Creates a query to retrieve a list of locations.

The queryLocations() function builds a query to retrieve a list of up to 1,000 locations and returns a LocationsQueryBuilder object.

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

You can refine the query by chaining LocationsQueryBuilder functions onto the query. LocationsQueryBuilder functions enable you to sort, filter, and control the results that queryLocations() returns. The functions that are chained to queryLocations() are applied in the order they are called.

queryLocations() runs with the following LocationsQueryBuilder defaults that you can override:

  • skip: 0
  • limit: 50

The following QueryLocationsBuilder functions are supported for the queryLocations() function. For a full description of the Locations object, see the object returned for the items property in LocationsQueryResult.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),exists(),in(),hasSome(),startsWith()
nameeq(),ne(),exists(),in(),hasSome(),startsWith()
descriptioneq(),ne(),exists(),in(),hasSome(),startsWith()
defaulteq(),ne(),exists(),in(),hasSome()
statuseq(),ne(),exists(),in(),hasSome()
locationTypeeq(),ne(),exists(),in(),hasSome()
faxeq(),ne(),exists(),in(),hasSome(),startsWith()
timeZoneeq(),ne(),exists(),in(),hasSome(),startsWith()
emaileq(),ne(),exists(),in(),hasSome(),startsWith()
phoneeq(),ne(),exists(),in(),hasSome(),startsWith()
address.countryeq(),ne(),exists(),in(),hasSome(),startsWith()
address.subdivisioneq(),ne(),exists(),in(),hasSome(),startsWith()
address.cityeq(),ne(),exists(),in(),hasSome(),startsWith()
address.postalCodeeq(),ne(),exists(),in(),hasSome(),startsWith()
address.streetAddress.numbereq(),ne(),exists(),in(),hasSome(),startsWith()
address.streetAddress.nameeq(),ne(),exists(),in(),hasSome(),startsWith()
address.streetAddress.apteq(),ne(),exists(),in(),hasSome(),startsWith()
address.formattedAddresseq(),ne(),exists(),in(),hasSome(),startsWith()
address.hinteq(),ne(),exists(),in(),hasSome(),startsWith()
address.geocode.latitudeeq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge()
address.geocode.longitudeeq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge()
businessSchedule.periods.openDayeq(),ne(),exists(),in(),hasSome()
businessSchedule.periods.openTimeeq(),ne(),exists(),in(),hasSome(),startsWith()
businessSchedule.periods.closeDayeq(),ne(),exists(),in(),hasSome()
businessSchedule.periods.closeTimeeq(),ne(),exists(),in(),hasSome(),startsWith()
businessSchedule.specialHourPeriod.startDateeq(),ne(),exists(),in(),hasSome(),startsWith()
businessSchedule.specialHourPeriod.endDateeq(),ne(),exists(),in(),hasSome(),startsWith()
businessSchedule.specialHourPeriod.isClosedeq(),ne(),exists(),in(),hasSome()
businessSchedule.specialHourPeriod.commenteq(),ne(),exists(),in(),hasSome(),startsWith()
revisioneq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge()
archivedeq(),ne(),exists(),in(),hasSome()
Permissions
Manage Bookings Services and Settings
Manage Bookings
Manage Calendars
Manage Bookings - all permissions
Read Bookings - all read permissions
Read Bookings - Including Participants
Read bookings calendar - including participants
Manage Locations
Manage Portfolio
Manage Restaurants - all permissions
Read Locations
Learn more about app permissions.
Method Declaration
Copy
function queryLocations(): LocationsQueryBuilder;
Request
This method does not take any parameters
Returns
JavaScript
import { locations } from "wix-business-tools.v2"; import { elevate } from "wix-auth"; export async function myQueryLocationsFunction() { try { const elevatedQueryLocations = elevate(locations.queryLocations); const myLocations = await elevatedQueryLocations().find(); const items = myLocations.items; console.log("Locations:", items); return items; } catch (error) { console.error(error); // Handle the error } } /* Returns items: * [ * { * "_id": "5c6e81a4-5270-4f66-9688-49d1fd9153ef", * "address": { * "city": "Amsterdam", * "country": "NL", * "formatted": "CityHub, Bellamystraat, Amsterdam, Netherlands", * "location": { * "latitude": 52.3672879, * "longitude": 4.867098899999998 * }, * "postalCode": "1053 BE", * "streetAddress": { * "apt": "", * "name": "Bellamystraat", * "number": "3" * }, * "subdivision": "NH" * }, * "archived": false, * "businessSchedule": { * "periods": [], * "specialHourPeriod": [] * }, * "default": false, * "email": "amsterdam.store@example.com", * "fax": "+31 20 765 4321", * "name": "Bellamystraat", * "phone": "+31 20 123 4567", * "status": "ACTIVE", * "timeZone": "Europe/Amsterdam", * "revision": "1" * }, * { * "_id": "e3b2c1ff-2bf2-41da-9f4a-983c8799074a", * "address": { * "city": "Brisbane City", * "country": "AU", * "formatted": "Arise, Margaret Street, Brisbane City QLD, Australia", * "location": { * "latitude": -27.4718535, * "longitude": 153.0288312 * }, * "postalCode": "4000", * "streetAddress": { * "apt": "", * "name": "Margaret Street", * "number": "222" * }, * "subdivision": "QLD" * }, * "archived": false, * "businessSchedule": { * "periods": [], * "specialHourPeriod": [] * }, * "default": false, * "email": "australia.store@examp;e.com", * "fax": "+61 2 9876 5432", * "name": "Margaret Street", * "phone": "+61 2 1234 5678", * "revision": "1", * "status": "ACTIVE", * "timeZone": "Australia/Brisbane" * } * ] */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?