> 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 # QueryActivityCounters # Package: activity # Namespace: ActivityCounters # Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/members/activity/activity-counters/query-activity-counters.md ## Permission Scopes: Read Activity Counters: SCOPE.DC-MEMBERS.READ-ACTIVITY-COUNTERS ## Introduction Returns up to 100 public activity counters for the provided filter and paging. Only counters that are marked as public are returned. Supported fields for filtering: - `memberId` Supported operations: Comparison: - $eq - $ne - $in Logical: - $and - $not - $or --- ## REST API ### Schema ``` Method: queryActivityCounters Description: Returns up to 100 public activity counters for the provided filter and paging. Only counters that are marked as public are returned. Supported fields for filtering: - `memberId` Supported operations: Comparison: - $eq - $ne - $in Logical: - $and - $not - $or URL: https://www.wixapis.com/members/v1/activity-counters/query Method: POST Method parameters: param name: query | type: Query - name: filter | type: Value | description: Filter object. - ONE-OF: - name: nullValue | type: | description: - name: numberValue | type: number | description: - name: stringValue | type: string | description: - name: boolValue | type: boolean | description: - name: structValue | type: object | description: - name: listValue | type: ListValue | description: - name: values | type: array | description: - name: paging | type: Paging | description: Paging options. - name: limit | type: integer | description: Number of items to load. - name: offset | type: integer | description: Number of items to skip in the current sort order. Return type: QueryActivityCountersResponse - name: activityCounters | type: array | description: Retrieved activity counters. - name: memberId | type: string | description: Member GUID. - name: appId | type: string | description: App GUID. When developing websites, if you set activity counter data using elevation, the action is assigned to the generic Wix code backend app: `151e476a-715e-ec33-db9a-a7ff4d51f70a`. - name: counters | type: array | description: Counters for this member. - name: key | type: string | description: Counter key, unique within the given app. - name: public | type: boolean | description: Whether this counter data is available to all. If `false`, the counter is only available to the data owner and counter owner. - name: count | type: integer | description: Activity count. - name: revision | type: string | description: Revision number, which increments by 1 each time the counter is updated. To prevent conflicting changes, the existing revision must be used when updating a counter. - name: metadata | type: PagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: offset | type: integer | description: Offset that was requested. - name: total | type: integer | description: Total number of items that match the query. - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field. ``` ### Examples ### Query activity counters Retrieving counters with member id ```curl curl -X POST \ https://www.wixapis.com/members/v1/activity-counters/query \ -H 'Authorization: ' \ -d '{ "query": { "filter": { "memberId": "987110f7-5100-4beb-a948-de610fd18f00" } } }' ``` ### Query activity counters Retrieving counters with two member ids and limit one ```curl curl -X POST \ https://www.wixapis.com/members/v1/activity-counters/query \ -H 'Authorization: ' \ -d '{ "query": { "filter": { "memberId": { "$in": [ "987110f7-5100-4beb-a948-de610fd18f00", "bc93bbe5-228e-4468-a9ac-ebc15f90427e" ] } }, "paging": { "limit": 1 } } }' ``` ### Query activity counters Retrieving counters with empty filter ```curl curl -X POST \ https://www.wixapis.com/members/v1/activity-counters/query \ -H 'Authorization: ' \ -d '{ "query": { "filter": {} } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.activity.ActivityCounters.queryActivityCounters(options) Description: Returns up to 100 public activity counters for the provided filter and paging. Only counters that are marked as public are returned. Supported fields for filtering: - `memberId` Supported operations: Comparison: - $eq - $ne - $in Logical: - $and - $not - $or Method parameters: param name: options | type: QueryActivityCountersOptions none - name: query | type: Query | description: Query options. - name: filter | type: Value | description: Filter object. - ONE-OF: - name: nullValue | type: | description: - name: numberValue | type: number | description: - name: stringValue | type: string | description: - name: boolValue | type: boolean | description: - name: structValue | type: object | description: - name: listValue | type: ListValue | description: - name: values | type: array | description: - name: paging | type: Paging | description: Paging options. - name: limit | type: integer | description: Number of items to load. - name: offset | type: integer | description: Number of items to skip in the current sort order. Return type: PROMISE - name: activityCounters | type: array | description: Retrieved activity counters. - name: memberId | type: string | description: Member GUID. - name: appId | type: string | description: App GUID. When developing websites, if you set activity counter data using elevation, the action is assigned to the generic Wix code backend app: `151e476a-715e-ec33-db9a-a7ff4d51f70a`. - name: counters | type: array | description: Counters for this member. - name: key | type: string | description: Counter key, unique within the given app. - name: public | type: boolean | description: Whether this counter data is available to all. If `false`, the counter is only available to the data owner and counter owner. - name: count | type: integer | description: Activity count. - name: revision | type: string | description: Revision number, which increments by 1 each time the counter is updated. To prevent conflicting changes, the existing revision must be used when updating a counter. - name: metadata | type: PagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: offset | type: integer | description: Offset that was requested. - name: total | type: integer | description: Total number of items that match the query. - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field. ``` ### Examples ### queryActivityCounters ```javascript import { activityCounters } from '@wix/activity-counters'; async function queryActivityCounters(options) { const response = await activityCounters.queryActivityCounters(options); }; ``` ### queryActivityCounters (with elevated permissions) ```javascript import { activityCounters } from '@wix/activity-counters'; import { auth } from '@wix/essentials'; async function myQueryActivityCountersMethod(options) { const elevatedQueryActivityCounters = auth.elevate(activityCounters.queryActivityCounters); const response = await elevatedQueryActivityCounters(options); } ``` ### queryActivityCounters (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 { activityCounters } from '@wix/activity-counters'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { activityCounters }, // Include the auth strategy and host as relevant }); async function queryActivityCounters(options) { const response = await myWixClient.activityCounters.queryActivityCounters(options); }; ``` ---