> 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 # CountComments # Package: comments # Namespace: CommentsNg # Method link: https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/comments/count-comments.md ## Permission Scopes: Manage Comments: SCOPE.DC_COMMENTS.MANAGE.COMMENTS ## Introduction Counts comments, given the specified filtering. Comments with the `HIDDEN` status are not included in the response. See [Query Comments](https://dev.wix.com/docs/rest/crm/community/comments/comments/query-comments.md) for a list of supported filters. --- ## REST API ### Schema ``` Method: countComments Description: Counts comments, given the specified filtering. Comments with the `HIDDEN` status are not included in the response. See [Query Comments](https://dev.wix.com/docs/rest/crm/community/comments/comments/query-comments.md) for a list of supported filters. URL: https://www.wixapis.com/comments/v1/comments/count Method: POST Method parameters: param name: appId | type: appId | description: App GUID to count the comments of. param name: filter | type: filter | description: Filter to identify the comments that need to be counted. Return type: CountCommentsResponse - name: count | type: integer | description: Number of comments. Possible Errors: HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TOO_MANY_TO_COUNT | Description: Number of comments exceeds the server's limit. ``` ### Examples ### Count Comments Count Wix Blog Comments written by specific member ```curl curl POST https://www.wixapis.com/comments/v1/comments/count \ -H 'Content-Type: application/json;charset=UTF-8' \ -H 'Authorization: ' \ -d '{ "appId": "14bcded7-0066-7c35-14d7-466cb3f09103", "filter": { "author.memberId": "81b3e2a2-60f4-4016-ab20-c2fda4c4c4f2" } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.comments.CommentsNg.countComments(appId, options) Description: Counts comments, given the specified filtering. Comments with the `HIDDEN` status are not included in the response. See [Query Comments](https://dev.wix.com/docs/rest/crm/community/comments/comments/query-comments.md) for a list of supported filters. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: appId Method parameters: param name: appId | type: string | description: App GUID to count the comments of. | required: true param name: options | type: CountCommentsOptions none - name: filter | type: object | description: Filter to identify the comments that need to be counted. Return type: PROMISE - name: count | type: integer | description: Number of comments. Possible Errors: HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TOO_MANY_TO_COUNT | Description: Number of comments exceeds the server's limit. ``` ### Examples ### countComments ```javascript import { comments } from '@wix/comments'; async function countComments(appId,options) { const response = await comments.countComments(appId,options); }; ``` ### countComments (with elevated permissions) ```javascript import { comments } from '@wix/comments'; import { auth } from '@wix/essentials'; async function myCountCommentsMethod(appId,options) { const elevatedCountComments = auth.elevate(comments.countComments); const response = await elevatedCountComments(appId,options); } ``` ### countComments (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/comments'; // 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 countComments(appId,options) { const response = await myWixClient.comments.countComments(appId,options); }; ``` ---