> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # QueryLocations # Package: services # Namespace: ServicesService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/query-locations.md ## Permission Scopes: Wix Multilingual - Nile Wrapper Domain Events Read: SCOPE.MULTILINGUAL.NILE_WRAPPER_DOMAIN_EVENTS_READ ## Introduction Retrieves 3 separate lists of business, custom, and customer [locations](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md), given the provided filtering, and whether each location is connected to at least one of the site's services. --- ## REST API ### Schema ``` Method: queryLocations Description: Retrieves 3 separate lists of business, custom, and customer [locations](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md), given the provided filtering, and whether each location is connected to at least one of the site's services. ### Defaults Query Locations has the following default setting, which you can't override: Sorted by `id` in ascending order. ### Filters For a complete list of supported filters, refer to the `location` object ([REST](https://dev.wix.com/docs/rest/business-management/locations/location-object.md)). When using date filters, you must use [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time). ### See also To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md) and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging.md). URL: https://www.wixapis.com/_api/bookings/v2/services/locations/query Method: POST Method parameters: param name: filter | type: QueryLocationsFilter - name: services | type: object | description: Service filter. See [Query Services](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/query-services.md) for a list of supported filters. - name: businessLocationIds | type: array | description: List of business GUIDs to filter by. Return type: QueryLocationsResponse - name: businessLocations | type: BusinessLocations | description: Retrieved business locations and whether each location is connected to at least one service. - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved business locations. - name: locations | type: array | description: Retrieved business locations. - ONE-OF: - name: business | type: BusinessLocationOptions | description: Information about business locations. - name: id | type: string | description: GUID of the business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). When setting a business location, specify only the location GUID. Other location details are overwritten. - name: name | type: string | description: Business location name. - name: default | type: boolean | description: Whether this is the default location. There can only be a single default location per site. - name: address | type: Address | description: Business location address. - ONE-OF: - name: streetAddress | type: StreetAddress | description: Street name and number. - name: number | type: string | description: Street number. - name: name | type: string | description: Street name. - name: apt | type: string | description: Apartment number. - name: addressLine | type: string | description: - name: country | type: string | description: 2-letter country code in an [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format. - name: subdivision | type: string | description: Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format. - name: city | type: string | description: City name. - name: postalCode | type: string | description: Postal or zip code. - name: formattedAddress | type: string | description: Full address of the location. - name: email | type: string | description: Business location email. - name: phone | type: string | description: Business location phone. - name: custom | type: CustomLocationOptions | description: Information about custom locations. - name: id | type: string | description: GUID of the custom location. - name: address | type: Address | description: Address of the custom location. - name: id | type: string | description: Location GUID. - name: type | type: LocationType | description: Location type. Default: `CUSTOM` - enum: - CUSTOM: Location set by the business that is not a standard business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). - BUSINESS: Business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). - CUSTOMER: The customer specifies any address when booking. Available only for appointment-based services. - name: calculatedAddress | type: Address | description: Location address. Empty for `{"type": "CUSTOMER"}`. - name: customLocations | type: CustomLocations | description: Retrieved custom locations and whether each location is connected to at least one service. - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved custom locations. - name: customerLocations | type: CustomerLocations | description: Retrieved customer locations and whether each location is connected to at least one service. - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved customer locations. ``` ### Examples ### Query locations ```curl curl -X POST 'https://www.wixapis.com/bookings/v2/services/locations/query' \ -H 'Authorization: ' \ -d '{ "filter": { "name": { "$startsWith": "New" } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.services.ServicesService.queryLocations(options) Description: Retrieves 3 separate lists of business, custom, and customer [locations](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md), given the provided filtering, and whether each location is connected to at least one of the site's services. ### Defaults Query Locations has the following default setting, which you can't override: Sorted by `id` in ascending order. ### Filters For a complete list of supported filters, refer to the `location` object ([REST](https://dev.wix.com/docs/rest/business-management/locations/location-object.md)). When using date filters, you must use [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time). ### See also To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md) and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging.md). Method parameters: param name: options | type: QueryLocationsOptions none - name: filter | type: QueryLocationsFilter | description: Filter. - name: services | type: object | description: Service filter. See [Query Services](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/query-services.md) for a list of supported filters. - name: businessLocationIds | type: array | description: List of business GUIDs to filter by. Return type: PROMISE - name: businessLocations | type: BusinessLocations | description: Retrieved business locations and whether each location is connected to at least one service. - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved business locations. - name: locations | type: array | description: Retrieved business locations. - ONE-OF: - name: business | type: BusinessLocationOptions | description: Information about business locations. - name: _id | type: string | description: GUID of the business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). When setting a business location, specify only the location GUID. Other location details are overwritten. - name: name | type: string | description: Business location name. - name: default | type: boolean | description: Whether this is the default location. There can only be a single default location per site. - name: address | type: Address | description: Business location address. - name: city | type: string | description: none - name: subdivision | type: string | description: none - name: country | type: string | description: none - name: postalCode | type: string | description: none - name: addressLine1 | type: string | description: none - name: email | type: string | description: Business location email. - name: phone | type: string | description: Business location phone. - name: custom | type: CustomLocationOptions | description: Information about custom locations. - name: _id | type: string | description: GUID of the custom location. - name: address | type: Address | description: Address of the custom location. - name: _id | type: string | description: Location GUID. - name: type | type: LocationType | description: Location type. Default: `CUSTOM` - enum: - CUSTOM: Location set by the business that is not a standard business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). - BUSINESS: Business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). - CUSTOMER: The customer specifies any address when booking. Available only for appointment-based services. - name: calculatedAddress | type: Address | description: Location address. Empty for `{"type": "CUSTOMER"}`. - name: customLocations | type: CustomLocations | description: Retrieved custom locations and whether each location is connected to at least one service. - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved custom locations. - name: customerLocations | type: CustomerLocations | description: Retrieved customer locations and whether each location is connected to at least one service. - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved customer locations. ``` ### Examples ### queryLocations ```javascript import { services } from '@wix/bookings'; async function queryLocations(options) { const response = await services.queryLocations(options); }; ``` ### queryLocations (with elevated permissions) ```javascript import { services } from '@wix/bookings'; import { auth } from '@wix/essentials'; async function myQueryLocationsMethod(options) { const elevatedQueryLocations = auth.elevate(services.queryLocations); const response = await elevatedQueryLocations(options); } ``` ### queryLocations (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { services } from '@wix/bookings'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { services }, // Include the auth strategy and host as relevant }); async function queryLocations(options) { const response = await myWixClient.services.queryLocations(options); }; ``` ---