> 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

# QueryAttributeValues

# Package: attributes

# Namespace: AttributeValuesService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/attributes/attribute-value/query-attribute-values.md

## Permission Scopes:
Manage_Wix_Attributes_Forms_submissions: SCOPE.ATTRIBUTES.MANAGE

## Introduction

Retrieves a list of up to 1000 attribute values, given the provided paging, filtering, and sorting.

Query Attribute Values runs with these defaults, which you can override:

- `createdDate` is sorted in `DESC` order
- `paging.limit` is `50`
- `paging.offset` is `0`

Supported filter and sort fields: `id`, `attributeDefinitionId`, `entityId`, `valueType`, `stringData`, `numberData`, `boolData`.

Attribute values don't carry `visibility`; it's defined on the attribute definition. To respect visibility, resolve each value's definition (for example, with Query Attribute Definitions) and filter out non-visible attributes before displaying them publicly.

To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).

---

## REST API

### Schema

```
 Method: queryAttributeValues
 Description: Retrieves a list of up to 1000 attribute values, given the provided paging, filtering, and sorting.  Query Attribute Values runs with these defaults, which you can override:  - `createdDate` is sorted in `DESC` order - `paging.limit` is `50` - `paging.offset` is `0`  Supported filter and sort fields: `id`, `attributeDefinitionId`, `entityId`, `valueType`, `stringData`, `numberData`, `boolData`.  Attribute values don't carry `visibility`; it's defined on the attribute definition. To respect visibility, resolve each value's definition (for example, with Query Attribute Definitions) and filter out non-visible attributes before displaying them publicly.  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).
 URL: https://www.wixapis.com/_api/attributes/v1/attribute-values/query
 Method: POST
 Method parameters:
   param name: query | type: CursorQuery    
     - name: cursorPaging | type: CursorPaging | description: Cursor paging options.  Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging).  
        - 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.  Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section).  
        - name: sort | type: array<Sorting> | description: Sort object.  Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-sort-section).  | 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, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: attributeDefinitionId | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: entityId | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: valueType | operators: $eq, $ne, $exists, $in, $hasSome | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: stringData | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: numberData | operators: $eq, $ne, $exists, $in, $hasSome, $lt, $lte, $gt, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: boolData | operators: $eq, $ne, $exists, $in, $hasSome | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: QueryAttributeValuesResponse
  - name: attributeValues | type: array<AttributeValue> | description: Matching attribute values.  | validation: maxItems 1000
     - ONE-OF: 
        - name: stringData | type: string | description: Value for STRING-type attribute. Must be in StringConfig.allowed_values.  | validation: maxLength 40
        - name: numberData | type: integer | description: Value for NUMBER-type attribute. Must be within NumberConfig [min, max].  
        - name: boolData | type: boolean | description: Value for BOOL-type attribute.  
     - name: id | type: string | description: Attribute value GUID.  | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the attribute value is updated.  | validation: format int64
     - name: createdDate | type: string | description: Date and time the attribute value was created.  | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the attribute value was last updated.  | validation: format date-time
     - name: attributeDefinitionId | type: string | description: GUID of the attribute definition this value belongs to.  | validation: format GUID
     - name: entityId | type: string | description: GUID of the entity this value belongs to. An entity is any resource your application owns (in the current Rentals integration, a Bookings resource); this API does not validate it. Use the same GUID passed to `BulkUpsertAttributeValues` and `ListEntityAttributes`.  | validation: format GUID
     - name: valueType | type: ValueType | description: Value type of this attribute. Matches the related attribute definition's value_type. Set on create and never changes.  
         - enum:
         -     STRING: String attribute: single-select from a predefined list of allowed string values.
         -     NUMBER: Integer number attribute with a required min/max range.
         -     BOOL: Boolean attribute (true/false).
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the attribute value. [Extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md) must be configured in the app dashboard before they can be accessed with API calls.  
        - 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 current page.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  + `true`: Another page of results can be retrieved. + `false`: This is the last page.  


```

### Examples

### Query attribute values by a boolean value.
```curl
curl -X POST \
'https://www.wixapis.com/attributes/v1/attribute-values/query' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "query": {
    "filter": {
      "boolData": true
    },
    "cursorPaging": {
      "limit": 50
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.bookings.attributeValue.queryAttributeValues(query)
 Description: Retrieves a list of up to 1000 attribute values, given the provided paging, filtering, and sorting.  Query Attribute Values runs with these defaults, which you can override:  - `createdDate` is sorted in `DESC` order - `paging.limit` is `50` - `paging.offset` is `0`  Supported filter and sort fields: `id`, `attributeDefinitionId`, `entityId`, `valueType`, `stringData`, `numberData`, `boolData`.  Attribute values don't carry `visibility`; it's defined on the attribute definition. To respect visibility, resolve each value's definition (for example, with Query Attribute Definitions) and filter out non-visible attributes before displaying them publicly.  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).
 # 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: AttributeValueQuery   | required: true 
     - name: cursorPaging | type: CursorPaging | description: Cursor paging options.  Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging).  
        - 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.  Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section).  
        - name: sort | type: array<Sorting> | description: Sort object.  Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-sort-section).  | 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, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: attributeDefinitionId | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: entityId | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: valueType | operators: $eq, $ne, $exists, $in, $hasSome | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: stringData | operators: $eq, $ne, $exists, $in, $hasSome, $startsWith, $gt, $lt, $lte, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: numberData | operators: $eq, $ne, $exists, $in, $hasSome, $lt, $lte, $gt, $gte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: boolData | operators: $eq, $ne, $exists, $in, $hasSome | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QueryAttributeValuesResponse>
  - name: attributeValues | type: array<AttributeValue> | description: Matching attribute values.  | validation: maxItems 1000
     - ONE-OF: 
        - name: stringData | type: string | description: Value for STRING-type attribute. Must be in StringConfig.allowed_values.  | validation: maxLength 40
        - name: numberData | type: integer | description: Value for NUMBER-type attribute. Must be within NumberConfig [min, max].  
        - name: boolData | type: boolean | description: Value for BOOL-type attribute.  
     - name: _id | type: string | description: Attribute value GUID.  | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the attribute value is updated.  | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the attribute value was created.  
     - name: _updatedDate | type: Date | description: Date and time the attribute value was last updated.  
     - name: attributeDefinitionId | type: string | description: GUID of the attribute definition this value belongs to.  | validation: format GUID
     - name: entityId | type: string | description: GUID of the entity this value belongs to. An entity is any resource your application owns (in the current Rentals integration, a Bookings resource); this API does not validate it. Use the same GUID passed to `BulkUpsertAttributeValues` and `ListEntityAttributes`.  | validation: format GUID
     - name: valueType | type: ValueType | description: Value type of this attribute. Matches the related attribute definition's value_type. Set on create and never changes.  
         - enum:
         -     STRING: String attribute: single-select from a predefined list of allowed string values.
         -     NUMBER: Integer number attribute with a required min/max range.
         -     BOOL: Boolean attribute (true/false).
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the attribute value. [Extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md) must be configured in the app dashboard before they can be accessed with API calls.  
        - 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 current page.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  + `true`: Another page of results can be retrieved. + `false`: This is the last page.  


```

### Examples

### Query attribute values by a boolean value
```javascript
import { attributeValue } from "@wix/bookings";

const query = {
  filter: { boolData: true },
  cursorPaging: { limit: 50 },
};

async function queryAttributeValues() {
  const response = await attributeValue.queryAttributeValues(query);
}

/* Promise resolves to:
 * {
 *   "attributeValues": [
 *     {
 *       "_id": "b1e6f0a2-3c4d-4e5f-9a8b-1c2d3e4f5a6b",
 *       "attributeDefinitionId": "d7a341c4-196b-46e7-813c-2b0fc1847ec6",
 *       "entityId": "5a9b3e88-1f6c-4f3b-9c7e-08e2f3b5a1b2",
 *       "valueType": "BOOL",
 *       "boolData": true
 *     }
 *   ],
 *   "pagingMetadata": { "count": 1, "cursors": {} }
 * }
 */

```

### queryAttributeValues (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 { attributeValue } from '@wix/bookings';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function queryAttributeValues(query) {
  const response = await myWixClient.attributeValue.queryAttributeValues(query);
};
```

---