> 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

# QueryComments

# Package: feedback

# Namespace: Comments

# Method link: https://dev.wix.com/docs/api-reference/account-level/studio-workspace/feedback/comment-v1/query-comments.md

## Permission Scopes:
Read Site Feedback: SCOPE.PARTNERS.FEEDBACK_READ

## Introduction

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

Query Comments runs with these defaults, which you can override:

- `id` is sorted in `ASC` order
- `cursorPaging.limit` is `50`

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) and [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md).

---

## REST API

### Schema

```
 Method: queryComments
 Description: Retrieves a list of up to 100 comments, given the provided paging, filtering, and sorting.  Query Comments runs with these defaults, which you can override:  - `id` is sorted in `ASC` order - `cursorPaging.limit` is `50`  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) and [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md).
 URL: https://www.wixapis.com/partners/feedback/v1/comments/query
 Method: POST
 Method parameters:
   param name: fields | type: array<fields> | description: Fields to return that aren't returned by default.  | validation: maxItems 10
                 - enum:
                 -     COMMENTER: The comment's `commenter`: the reviewer's name and email.
   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, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: feedbackId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: commenterId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: status | operators: $eq, $ne, $in, $exists | 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
 Return type: QueryCommentsResponse
  - name: comments | type: array<Comment> | description: Retrieved comments.  
     - name: id | type: string | description: Comment GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the comment is updated. To prevent conflicting changes, the current revision must be passed when updating the comment.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the comment was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the comment was updated.  | read-only: true | validation: format date-time
     - name: feedbackId | type: string | description: GUID of the [feedback session](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/feedback/feedback-session-v1/introduction.md) the comment belongs to.  A feedback session scopes a round of review on a site and carries an expiration date. Once a session lapses it accepts no new comments, but the comments already in it stay readable and can still be triaged and replied to.  | read-only: true | validation: format GUID
     - name: commenterId | type: string | description: GUID of the commenter who left the comment.  | read-only: true | validation: format GUID
     - name: message | type: string | description: Text of the comment.  | validation: minLength 2, maxLength 2000
     - name: status | type: Status | description: Triage status of the comment.  Every comment starts as `NEW`. [Update Comment Status](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/feedback/comment-v1/update-comment-status.md) is the only way for the site owner to change it, and a commenter can't set the status of their own comment. A comment does return to `NEW` on its own when the commenter replies to it, whatever it was triaged as; a reply from anyone else leaves the status alone. The commenter can also reopen a `RESOLVED` comment, which returns it to `NEW`.  | read-only: true 
         - enum:
         -     NEW: The comment hasn't been read yet.
         -     OPEN: The comment has been read but isn't resolved.
         -     RESOLVED: The comment has been dealt with.
     - name: commentLocation | type: CommentLocation | description: Where on the page the comment is anchored.  
        - name: pageId | type: string | description: GUID of the editor page the comment was left on.  | validation: maxLength 100
        - name: x | type: number | description: Horizontal position of the comment on the page.  
        - name: y | type: number | description: Vertical position of the comment on the page.  
        - name: breakpoint | type: Breakpoint | description: Responsive-design breakpoint the comment was left at.  
           - name: id | type: string | description: Breakpoint GUID.  | validation: maxLength 100
           - name: minWidth | type: integer | description: Lowest viewport width the breakpoint applies to, in pixels.  
           - name: maxWidth | type: integer | description: Highest viewport width the breakpoint applies to, in pixels.  
        - name: innerPath | type: string | description: Inner path of the Wix dynamic page the comment was left on.  | validation: maxLength 2048
        - name: position | type: Position | description: Position of the comment relative to the element it's attached to.  
           - name: selector | type: string | description: DOM selector of the target element.  | validation: maxLength 1024
           - name: offsetXPct | type: number | description: Horizontal offset within the element, as a percentage of its width.  
           - name: offsetYPct | type: number | description: Vertical offset within the element, as a percentage of its height.  
           - name: innerPath | type: string | description: Inner path of the Wix dynamic page the element is on.  | validation: maxLength 2048
     - name: replies | type: array<CommentReply> | description: Replies to the comment, ordered oldest first.  A reply is addressed by its index in this list, so indexes shift when an earlier reply is deleted. Pass the comment's current `revision` when updating or deleting a reply to be sure the index you're addressing is still the one you read.  | read-only: true | validation: maxItems 1000
        - name: message | type: string | description: Text of the reply.  | validation: minLength 1, maxLength 2000
        - name: createdDate | type: string | description: Date and time the reply was created.  | read-only: true | validation: format date-time
        - name: replier | type: Replier | description: Who wrote the reply.  | read-only: true 
           - ONE-OF: 
              - name: wixUserOptions | type: WixUserOptions | description: The Wix user who wrote the reply, when `type` is `WIX_USER`.  
                 - name: accountId | type: string | description: GUID of the account the Wix user was logged in to when they replied. This isn't necessarily the account that owns the site.  A `WIX_USER` replier with no `accountId` is the agency that owns the site.  | validation: format GUID
           - name: type | type: Type | description: What kind of identity wrote the reply.  
                 - enum:
                 -     COMMENTER: The comment's commenter. Their name comes from the commenter with the comment's `commenterId`.
                 -     WIX_USER: A Wix user: a user of the agency that owns the site, or of a collaborator account. Details are in `wixUserOptions`.  A `WIX_USER` replier with no `accountId` is the agency that owns the site.
     - name: commenter | type: CommenterInfo | description: The reviewer who left the comment, as they introduced themselves.  Returned only when `COMMENTER` is passed in the request's `fields`, and only once the reviewer has given their name.  | read-only: true 
        - name: name | type: string | description: Display name of the reviewer.  | validation: maxLength 100
        - name: email | type: string | description: Email address of the reviewer, if they gave one.  | validation: format EMAIL
  - 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 Comments
Retrieves the comments that haven't been read yet, oldest first

```curl
curl -X POST \
'https://www.wixapis.com/partners/feedback/v1/comments/query' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "query": {
    "filter": {
      "status": "NEW"
    },
    "sort": [
      {
        "fieldName": "createdDate",
        "order": "ASC"
      }
    ],
    "cursorPaging": {
      "limit": 2
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.feedback.comments.queryComments(query, options)
 Description: Retrieves a list of up to 100 comments, given the provided paging, filtering, and sorting.  Query Comments runs with these defaults, which you can override:  - `id` is sorted in `ASC` order - `cursorPaging.limit` is `50`  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) and [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.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: options | type: QueryCommentsOptions  none  
        - name: fields | type: array<CommentRequestedFields> | description: Fields to return that aren't returned by default.  | validation: maxItems 10
             - enum:
             -     COMMENTER: The comment's `commenter`: the reviewer's name and email.
   param name: query | type: CursorQuery   | 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
 Return type: PROMISE<QueryCommentsResponse>
  - name: comments | type: array<Comment> | description: Retrieved comments.  
     - name: _id | type: string | description: Comment GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the comment is updated. To prevent conflicting changes, the current revision must be passed when updating the comment.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the comment was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the comment was updated.  | read-only: true 
     - name: feedbackId | type: string | description: GUID of the [feedback session](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/feedback/feedback-session-v1/introduction.md) the comment belongs to.  A feedback session scopes a round of review on a site and carries an expiration date. Once a session lapses it accepts no new comments, but the comments already in it stay readable and can still be triaged and replied to.  | read-only: true | validation: format GUID
     - name: commenterId | type: string | description: GUID of the commenter who left the comment.  | read-only: true | validation: format GUID
     - name: message | type: string | description: Text of the comment.  | validation: minLength 2, maxLength 2000
     - name: status | type: Status | description: Triage status of the comment.  Every comment starts as `NEW`. [Update Comment Status](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/feedback/comment-v1/update-comment-status.md) is the only way for the site owner to change it, and a commenter can't set the status of their own comment. A comment does return to `NEW` on its own when the commenter replies to it, whatever it was triaged as; a reply from anyone else leaves the status alone. The commenter can also reopen a `RESOLVED` comment, which returns it to `NEW`.  | read-only: true 
         - enum:
         -     NEW: The comment hasn't been read yet.
         -     OPEN: The comment has been read but isn't resolved.
         -     RESOLVED: The comment has been dealt with.
     - name: commentLocation | type: CommentLocation | description: Where on the page the comment is anchored.  
        - name: pageId | type: string | description: GUID of the editor page the comment was left on.  | validation: maxLength 100
        - name: x | type: number | description: Horizontal position of the comment on the page.  
        - name: y | type: number | description: Vertical position of the comment on the page.  
        - name: breakpoint | type: Breakpoint | description: Responsive-design breakpoint the comment was left at.  
           - name: _id | type: string | description: Breakpoint GUID.  | validation: maxLength 100
           - name: minWidth | type: integer | description: Lowest viewport width the breakpoint applies to, in pixels.  
           - name: maxWidth | type: integer | description: Highest viewport width the breakpoint applies to, in pixels.  
        - name: innerPath | type: string | description: Inner path of the Wix dynamic page the comment was left on.  | validation: maxLength 2048
        - name: position | type: Position | description: Position of the comment relative to the element it's attached to.  
           - name: selector | type: string | description: DOM selector of the target element.  | validation: maxLength 1024
           - name: offsetXPct | type: number | description: Horizontal offset within the element, as a percentage of its width.  
           - name: offsetYPct | type: number | description: Vertical offset within the element, as a percentage of its height.  
           - name: innerPath | type: string | description: Inner path of the Wix dynamic page the element is on.  | validation: maxLength 2048
     - name: replies | type: array<CommentReply> | description: Replies to the comment, ordered oldest first.  A reply is addressed by its index in this list, so indexes shift when an earlier reply is deleted. Pass the comment's current `revision` when updating or deleting a reply to be sure the index you're addressing is still the one you read.  | read-only: true | validation: maxItems 1000
        - name: message | type: string | description: Text of the reply.  | validation: minLength 1, maxLength 2000
        - name: _createdDate | type: Date | description: Date and time the reply was created.  | read-only: true 
        - name: replier | type: Replier | description: Who wrote the reply.  | read-only: true 
           - ONE-OF: 
              - name: wixUserOptions | type: WixUserOptions | description: The Wix user who wrote the reply, when `type` is `WIX_USER`.  
                 - name: accountId | type: string | description: GUID of the account the Wix user was logged in to when they replied. This isn't necessarily the account that owns the site.  A `WIX_USER` replier with no `accountId` is the agency that owns the site.  | validation: format GUID
           - name: type | type: Type | description: What kind of identity wrote the reply.  
                 - enum:
                 -     COMMENTER: The comment's commenter. Their name comes from the commenter with the comment's `commenterId`.
                 -     WIX_USER: A Wix user: a user of the agency that owns the site, or of a collaborator account. Details are in `wixUserOptions`.  A `WIX_USER` replier with no `accountId` is the agency that owns the site.
     - name: commenter | type: CommenterInfo | description: The reviewer who left the comment, as they introduced themselves.  Returned only when `COMMENTER` is passed in the request's `fields`, and only once the reviewer has given their name.  | read-only: true 
        - name: name | type: string | description: Display name of the reviewer.  | validation: maxLength 100
        - name: email | type: string | description: Email address of the reviewer, if they gave one.  | validation: format EMAIL
  - 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 comments
Retrieves the comments that haven't been read yet, oldest first

```javascript
import { comments } from "@wix/feedback";

async function queryComments() {
  const response = await comments.queryComments({
    filter: { status: "NEW" },
    sort: [{ fieldName: "createdDate", order: "ASC" }],
    cursorPaging: { limit: 2 },
  });
}

/* Promise resolves to:
 * {
 *   "comments": [
 *     {
 *       "_id": "8046df3c-7575-4098-a5ab-c91ad8f33c47",
 *       "revision": "1",
 *       "_createdDate": "2024-01-15T10:30:00.000Z",
 *       "_updatedDate": "2024-01-15T10:30:00.000Z",
 *       "feedbackId": "3f1a6c2e-9b47-4b1e-8c55-2d7a9f0e5b31",
 *       "commenterId": "e2f06b91-8d4a-4c37-b519-3a7c60d8e4f2",
 *       "message": "The hero image looks stretched on mobile.",
 *       "status": "NEW",
 *       "commentLocation": { "pageId": "c1dmp", "x": 412.5, "y": 980.25 },
 *       "replies": []
 *     },
 *     {
 *       "_id": "b93e1f07-2c4a-4e68-9f15-6d0a3b7c8e29",
 *       "revision": "1",
 *       "_createdDate": "2024-01-15T11:05:42.000Z",
 *       "_updatedDate": "2024-01-15T11:05:42.000Z",
 *       "feedbackId": "3f1a6c2e-9b47-4b1e-8c55-2d7a9f0e5b31",
 *       "commenterId": "e2f06b91-8d4a-4c37-b519-3a7c60d8e4f2",
 *       "message": "Can we use the updated logo in the footer?",
 *       "status": "NEW",
 *       "commentLocation": { "pageId": "c1dmp", "x": 220, "y": 2140.75 },
 *       "replies": []
 *     }
 *   ],
 *   "pagingMetadata": {
 *     "count": 2,
 *     "cursors": { "next": "gaXIAgAAAAAAAAAAGmYKZAoJY3JlYXRlZERhdGUSVwoV" },
 *     "hasNext": true
 *   }
 * }
 */

```

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

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


async function queryComments(query,options) {
  const response = await myWixClient.comments.queryComments(query,options);
};
```

---