> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# QueryResources

# Package: resources

# Namespace: ResourcesService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/query-resources?apiView=SDK.md

## Permission Scopes:
Read Bookings - Public Data: SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC

## Introduction

Retrieves a list of up to 100 resources, given the provided filtering,
sorting, and paging.

---

## REST API

### Schema

```
 Method: queryResources
 Description: Retrieves a list of up to 100 resources, given the provided filtering, sorting, and paging.
 URL: https://www.wixapis.com/bookings/v2/resources/query
 Method: POST
 Method parameters:
   param name: query | type: CursorQuery    
     - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.  
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | validation: maxItems 5
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
 Query fields:
   - field: id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: typeId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: createdDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: updatedDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: locationOptions.availableInAllLocations | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: locationOptions.specificLocationOptions.availableInBusinessLocations | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: locationOptions.specificLocationOptions.businessLocations.locationId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: eventsSchedule.scheduleId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: singleResource.locationOptions.availableInAllLocations | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: singleResource.locationOptions.specificLocationOptions.availableInBusinessLocations | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: singleResource.locationOptions.specificLocationOptions.businessLocations.locationId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: QueryResourcesResponse
  - name: resources | type: array<Resource> | description: Retrieved resources.  
     - name: id | type: string | description: Resource GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the resource is updated. To prevent conflicting changes, the current revision must be passed when updating the resource.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Time in `YYYY-MM-DDThh:mm:ss.sssZ` format the resource was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Time in `YYYY-MM-DDThh:mm:ss.sssZ` format the resource was last updated.  | read-only: true | validation: format date-time
     - name: name | type: string | description: Name of the resource.  | validation: minLength 1, maxLength 40
     - name: typeId | type: string | description: GUID of the [resource type](https://dev.wix.com/docs/rest/business-solutions/bookings/resources/resource-types-v2/introduction.md).  Once a type has been set it can't be modified. You can create a resource without specifying a type. However, customers can't book such resources.  | validation: format GUID, immutable
     - name: workingHoursSchedules | type: WorkingHoursSchedules | description: Information about the [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md) specifying the working hours and locations of the resource.  Resources without a working hour schedule are available 24/7 at the locations specified in the field `locationOptions`. When both `workingHoursSchedules` and `locationOptions` are set, `workingHoursSchedules` takes precedence.  
        - name: values | type: array<WorkingHoursSchedule> | description: Schedules specifying the working hours of the resource. Currently, only a single schedule is supported.  | validation: maxItems 1
           - name: scheduleId | type: string | description: GUID of the working hour [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md).  | validation: format GUID
           - name: shared | type: boolean | description: Whether the schedule is shared by multiple resources or unique for this resource.  Default: `false`  | read-only: true 
     - name: locationOptions | type: LocationOptions | description: Information about the location where the resource is available.  
        - name: availableInAllLocations | type: boolean | description: Whether the resource is available in all [business locations](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-locations.md#location-types).  - `true`: The resource is available in all business locations. - `false`: The resource is available only in specific locations.  Default: `false`  
        - name: specificLocationOptions | type: SpecificLocation | description: Details of resource availability in specific locations.  
           - name: availableInBusinessLocations | type: boolean | description: Whether the resource is available in [business locations](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-locations.md#location-types).  - `true`: The resource is available in business locations. - `false`: The resource isn't available in business locations.  Default: `false`  
           - name: businessLocations | type: array<BusinessLocation> | description: Information about the business locations where the resource is available. Not returned, if the resource is available in either all business locations or in no business location. You can specify up to 100 business locations.  | validation: maxItems 100
              - name: locationId | type: string | description: GUID of the business [location](https://dev.wix.com/docs/rest/business-management/locations/introduction.md).  | validation: format GUID
     - name: eventsSchedule | type: EventsSchedule | description: Schedule containing the [events](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction.md) for which the resource has been booked.  | read-only: true 
        - name: scheduleId | type: string | description: GUID of the event [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md).  | validation: format GUID
     - name: extendedFields | type: ExtendedFields | description: Extensions enabling users to save custom data related to the resource.  
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the current response page.  This count reflects the actual number of items in the current result set, which may be less than the requested limit if fewer items are available.  | validation: format int32
     - name: cursors | type: Cursors | description: Navigation cursors for moving between result pages.  Contains `next` and `prev` cursor tokens for pagination. Use the `next` cursor to retrieve subsequent pages and `prev` cursor to go back to previous pages. Learn more about cursor paging in the [API Query Language guide](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_cursor-paging).  
        - name: next | type: string | description: Cursor token for retrieving the next page of results.  Use this token in subsequent requests to continue pagination forward. Value is `null` when on the last page of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor token for retrieving the previous page of results.  Use this token to navigate backwards through result pages. Value is `null` when on the first page of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Indicates whether additional results are available beyond the current page.  - `true`: More results exist and can be retrieved using the `next` cursor. - `false`: This is the final page of results.  


```

### Examples

### Query resources.
Query resources, providing a filter by a specific business location.

```curl
curl -X POST \
'https://www.wixapis.com/bookings/v2/resources/query' \
-H 'Authorization: <AUTH>' \
-d '{
  "query": {
    "filter": {
      "$and": [
        {
          "locationOptions.specificLocationOptions.availableInBusinessLocations": {
            "$eq": true
          }
        },
        {
          "locationOptions.specificLocationOptions.businessLocations.locationId": {
            "$hasSome": "1295e5ff-ecb3-41bc-8b6f-7345792e5ec0"
          }
        }
      ]
    }
  }
}'
```

### Query resources.
Query resources, filtering by resource type and providing a limit to the number of results returned.

```curl
curl -X POST \
'https://www.wixapis.com/bookings/v2/resources/query' \
-H 'Authorization: <AUTH>' \
-d '{
  "query": {
    "filter": {
      "type": {
        "$eq": "dd7790c7-f3ac-4821-accb-52ed385fd932"
      }
    },
    "cursorPaging": {
      "cursor": null,
      "limit": 100
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.bookings.resources.queryResources(query)
 Description: Retrieves a list of up to 100 resources, given the provided filtering, sorting, and paging.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  query
 Method parameters: 
   param name: query | type: ResourceQuery   | required: true 
     - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.  
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | validation: maxItems 5
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
 Query fields:
   - field: _id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: typeId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: _createdDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: _updatedDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: locationOptions.availableInAllLocations | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: locationOptions.specificLocationOptions.availableInBusinessLocations | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: locationOptions.specificLocationOptions.businessLocations.locationId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: eventsSchedule.scheduleId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QueryResourcesResponse>
  - name: resources | type: array<Resource> | description: Retrieved resources.  
     - name: _id | type: string | description: Resource GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the resource is updated. To prevent conflicting changes, the current revision must be passed when updating the resource.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Time in `YYYY-MM-DDThh:mm:ss.sssZ` format the resource was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Time in `YYYY-MM-DDThh:mm:ss.sssZ` format the resource was last updated.  | read-only: true 
     - name: name | type: string | description: Name of the resource.  | validation: minLength 1, maxLength 40
     - name: typeId | type: string | description: GUID of the [resource type](https://dev.wix.com/docs/rest/business-solutions/bookings/resources/resource-types-v2/introduction.md).  Once a type has been set it can't be modified. You can create a resource without specifying a type. However, customers can't book such resources.  | validation: format GUID, immutable
     - name: workingHoursSchedules | type: WorkingHoursSchedules | description: Information about the [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md) specifying the working hours and locations of the resource.  Resources without a working hour schedule are available 24/7 at the locations specified in the field `locationOptions`. When both `workingHoursSchedules` and `locationOptions` are set, `workingHoursSchedules` takes precedence.  
        - name: values | type: array<WorkingHoursSchedule> | description: Schedules specifying the working hours of the resource. Currently, only a single schedule is supported.  | validation: maxItems 1
           - name: scheduleId | type: string | description: GUID of the working hour [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md).  | validation: format GUID
           - name: shared | type: boolean | description: Whether the schedule is shared by multiple resources or unique for this resource.  Default: `false`  | read-only: true 
     - name: locationOptions | type: LocationOptions | description: Information about the location where the resource is available.  
        - name: availableInAllLocations | type: boolean | description: Whether the resource is available in all [business locations](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-locations.md#location-types).  - `true`: The resource is available in all business locations. - `false`: The resource is available only in specific locations.  Default: `false`  
        - name: specificLocationOptions | type: SpecificLocation | description: Details of resource availability in specific locations.  
           - name: availableInBusinessLocations | type: boolean | description: Whether the resource is available in [business locations](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-locations.md#location-types).  - `true`: The resource is available in business locations. - `false`: The resource isn't available in business locations.  Default: `false`  
           - name: businessLocations | type: array<BusinessLocation> | description: Information about the business locations where the resource is available. Not returned, if the resource is available in either all business locations or in no business location. You can specify up to 100 business locations.  | validation: maxItems 100
              - name: locationId | type: string | description: GUID of the business [location](https://dev.wix.com/docs/rest/business-management/locations/introduction.md).  | validation: format GUID
     - name: eventsSchedule | type: EventsSchedule | description: Schedule containing the [events](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction.md) for which the resource has been booked.  | read-only: true 
        - name: scheduleId | type: string | description: GUID of the event [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md).  | validation: format GUID
     - name: extendedFields | type: ExtendedFields | description: Extensions enabling users to save custom data related to the resource.  
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the current response page.  This count reflects the actual number of items in the current result set, which may be less than the requested limit if fewer items are available.  | validation: format int32
     - name: cursors | type: Cursors | description: Navigation cursors for moving between result pages.  Contains `next` and `prev` cursor tokens for pagination. Use the `next` cursor to retrieve subsequent pages and `prev` cursor to go back to previous pages. Learn more about cursor paging in the [API Query Language guide](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_cursor-paging).  
        - name: next | type: string | description: Cursor token for retrieving the next page of results.  Use this token in subsequent requests to continue pagination forward. Value is `null` when on the last page of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor token for retrieving the previous page of results.  Use this token to navigate backwards through result pages. Value is `null` when on the first page of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Indicates whether additional results are available beyond the current page.  - `true`: More results exist and can be retrieved using the `next` cursor. - `false`: This is the final page of results.  


```

### Examples

### queryResources
```javascript
import { resources } from '@wix/bookings';

async function queryResources(query) {
  const response = await resources.queryResources(query);
};
```

### queryResources (with elevated permissions)
```javascript
import { resources } from '@wix/bookings';
import { auth } from '@wix/essentials';

async function myQueryResourcesMethod(query) {
  const elevatedQueryResources = auth.elevate(resources.queryResources);
  const response = await elevatedQueryResources(query);
}
```

### queryResources (self-managed)
Self-managed 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 { resources } from '@wix/bookings';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { resources },
  // Include the auth strategy and host as relevant
});


async function queryResources(query) {
  const response = await myWixClient.resources.queryResources(query);
};
```

---