> 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
# Method name: searchAccounts(search: CursorSearch)
# Method package: wixLoyaltyV2
# Method menu location: wixLoyaltyV2 --> accounts --> searchAccounts
# Method Link: https://dev.wix.com/docs/velo/apis/wix-loyalty-v2/accounts/search-accounts.md
# Method Description:
Retrieves a list of accounts, given the provided filters and search capabilities.
Search is executed on the account's name and email values.
| Property | Capabilities | Filters
|-------|------------|------|
| `_updatedDate` | Search: ✗
Aggregate: ✓
Sort: `ASC`, `DESC` | `$eq`, `$ne`, `$exists`, `$in`, `$any`, `$lt`, `$lte`, `$gt`, `$gte` |
| `contact._id` | Search: ✗
Aggregate: ✓
Sort: `ASC`, `DESC` | `$eq`, `$ne`, `$exists`, `$in`, `$any`, `$begins`, `$gt`, `$lt`, `$lte`, `$gte` |
| `contact.displayName` | Search: ✗
Aggregate: ✗
Sort: `ASC`, `DESC` | `$eq`, `$ne`, `$exists`, `$in`, `$any`, `$begins`, `$gt`, `$lt`, `$lte`, `$gte` |
| `contact.email` | Search: ✓
Aggregate: ✗
Sort: `ASC`, `DESC` | `$eq`, `$ne`, `$exists`, `$in`, `$any`, `$begins`, `$gt`, `$lt`, `$lte`, `$gte` |
| `contact.name` | Search: ✓
Aggregate: ✗
Sort: `ASC`, `DESC` | `$eq`, `$ne`, `$exists`, `$in`, `$any`, `$begins`, `$gt`, `$lt`, `$lte`, `$gte` |
| `lastActivityDate` | Search: ✗
Aggregate: ✓
Sort: `ASC`, `DESC` | `$eq`, `$ne`, `$exists`, `$in`, `$any`, `$lt`, `$lte`, `$gt`, `$gte` |
| `points.balance` | Search: ✗
Aggregate: ✓
Sort: `ASC`, `DESC` | `$eq`, `$ne`, `$exists`, `$in`, `$any`, `$lt`, `$lte`, `$gt`, `$gte` |
| `points.redeemed` | Search: ✗
Aggregate: ✓
Sort: `ASC`, `DESC` | `$eq`, `$ne`, `$exists`, `$in`, `$any`, `$lt`, `$lte`, `$gt`, `$gte` |
| `pointsExpiration.expirationDate` | Search: ✗
Aggregate: ✓
Sort: `ASC`, `DESC` | `$eq`, `$ne`, `$exists`, `$in`, `$any`, `$lt`, `$lte`, `$gt`, `$gte` |
# Method Code Examples:
*** Note: do not assume any prop names or enum values other than the ones in the example.
## Search accounts with no option parameters
```javascript
import { accounts } from "wix-loyalty.v2";
import { webMethod, Permissions } from "wix-web-module";
import { elevate } from "wix-auth";
/* Sample options value:
*
* {
* "options": null
* }
*/
const elevatedSearchAccounts = elevate(accounts.searchAccounts);
export const searchAccounts = webMethod(
Permissions.Anyone,
async (options) => {
try {
const result = await elevatedSearchAccounts(options);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
});
/* Promise resolves to:
*
* {
* "accounts": [
* {
* "_createdDate": "2024-06-10T15:26:12.553Z",
* "_id": "12cebdaf-2b05-4224-baea-2e53d4e13b41",
* "_updatedDate": "2024-06-10T15:26:46.454Z",
* "contact": {
* "name": "Lucas Chang",
* "email": "lucas.chang@example.com",
* "displayName": "Lucas Chang",
* "_id": "82f12a1e-cc06-497a-8967-28440510471a"
* },
* "contactId": "82f12a1e-cc06-497a-8967-28440510471a",
* "lastActivityDate": "2024-06-10T15:26:12.758Z",
* "description": "Sign up to the site",
* "appId": "SiteMembers",
* "idempotencyKey": "82f12a1e-cc06-497a-8967-28440510471a:c138c707-029a-461b-a6b7-9ba796e61fcac96b503d-5af1-4fd1-b224-ae920ede83c3",
* "_id": "3eed23eb-9869-48c9-b49b-b1b39bc36d0d",
* "_createdDate": "2024-06-10T15:26:12.758Z"
* },
* "points": {
* "balance": 50,
* "earned": 50,
* "adjusted": 0,
* "redeemed": 0,
* "expired": 0
* },
* "pointsExpiration": {
* "expirationDate": "2024-09-10T15:26:13.001Z",
* "expiringPointsAmount": 50
* },
* "revision": "5",
* "rewardAvailable": true,
* "tier": {
* "points": 50,
* "_updatedDate": "2024-06-10T15:26:12.825Z"
* },
* "memberId": "82f12a1e-cc06-497a-8967-28440510471a"
* },
* {
* "_createdDate": "2024-06-10T15:26:16.832Z",
* "_id": "5e6e67fd-7cd0-42ae-abc6-3a651f0593c4",
* "_updatedDate": "2024-06-10T15:26:50.119Z",
* "contact": {
* "name": "Amir Khan",
* "email": "amir.khan@example.com",
* "displayName": "Amir Khan",
* "_id": "bb3ed529-4722-440c-8a71-af808ffc12fd"
* },
* "contactId": "bb3ed529-4722-440c-8a71-af808ffc12fd",
* "lastActivityDate": "2024-06-10T15:26:16.944Z",
* "points": {
* "balance": 50,
* "earned": 50,
* "adjusted": 0,
* "redeemed": 0,
* "expired": 0
* },
* "pointsExpiration": {
* "expirationDate": "2024-09-10T15:26:17.186Z",
* "expiringPointsAmount": 50
* },
* "revision": "5",
* "rewardAvailable": true,
* "tier": {
* "points": 50,
* "_updatedDate": "2024-06-10T15:26:16.996Z"
* },
* "memberId": "bb3ed529-4722-440c-8a71-af808ffc12fd"
* },
* {
* "_createdDate": "2024-06-10T15:17:35.120Z",
* "_id": "866bdab0-d192-40f7-8821-fbfca2961c27",
* "_updatedDate": "2024-06-10T15:33:29.015Z",
* "contact": {
* "name": "Elena Rodriguez",
* "email": "elena.rodriguez@example.com",
* "displayName": "Elena Rodriguez",
* "_id": "2bb7d76e-de13-4909-ac12-8ab763d4b233"
* },
* "contactId": "2bb7d76e-de13-4909-ac12-8ab763d4b233",
* "lastActivityDate": "2024-06-10T15:31:02.699Z",
* "points": {
* "balance": 230,
* "earned": 50,
* "adjusted": 180,
* "redeemed": 0,
* "expired": 0
* },
* "pointsExpiration": {
* "expirationDate": "2024-09-10T15:17:35.538Z",
* "expiringPointsAmount": 230
* },
* "revision": "8",
* "rewardAvailable": true,
* "tier": {
* "points": 230,
* "_id": "b8501f07-a34f-4608-b9b0-168e6c6c505a",
* "_updatedDate": "2024-06-10T15:31:02.783Z"
* },
* "memberId": "2bb7d76e-de13-4909-ac12-8ab763d4b233"
* }
* ],
* "pagingMetadata": {
* "count": 5,
* "cursors": {},
* "hasNext": false
* }
* }
*/
```
## Search accounts (dashboard page code)
```javascript
import { accounts } from "wix-loyalty.v2";
/* Sample options value:
*
* {
* "options": null
* }
*/
async function searchAccounts(options) {
try {
const result = await accounts.searchAccounts(options);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
*
* {
* "accounts": [
* {
* "_createdDate": "2024-06-10T15:26:12.553Z",
* "_id": "12cebdaf-2b05-4224-baea-2e53d4e13b41",
* "_updatedDate": "2024-06-10T15:26:46.454Z",
* "contact": {
* "name": "Lucas Chang",
* "email": "lucas.chang@example.com",
* "displayName": "Lucas Chang",
* "_id": "82f12a1e-cc06-497a-8967-28440510471a"
* },
* "contactId": "82f12a1e-cc06-497a-8967-28440510471a",
* "lastActivityDate": "2024-06-10T15:26:12.758Z",
* "points": {
* "balance": 50,
* "earned": 50,
* "adjusted": 0,
* "redeemed": 0,
* "expired": 0
* },
* "pointsExpiration": {
* "expirationDate": "2024-09-10T15:26:13.001Z",
* "expiringPointsAmount": 50
* },
* "revision": "5",
* "rewardAvailable": true,
* "tier": {
* "points": 50,
* "_updatedDate": "2024-06-10T15:26:12.825Z"
* },
* "memberId": "82f12a1e-cc06-497a-8967-28440510471a"
* },
* {
* "_createdDate": "2024-06-10T15:26:16.832Z",
* "_id": "5e6e67fd-7cd0-42ae-abc6-3a651f0593c4",
* "_updatedDate": "2024-06-10T15:26:50.119Z",
* "contact": {
* "name": "Amir Khan",
* "email": "amir.khan@example.com",
* "displayName": "Amir Khan",
* "_id": "bb3ed529-4722-440c-8a71-af808ffc12fd"
* },
* "contactId": "bb3ed529-4722-440c-8a71-af808ffc12fd",
* "lastActivityDate": "2024-06-10T15:26:16.944Z",
* "points": {
* "balance": 50,
* "earned": 50,
* "adjusted": 0,
* "redeemed": 0,
* "expired": 0
* },
* "pointsExpiration": {
* "expirationDate": "2024-09-10T15:26:17.186Z",
* "expiringPointsAmount": 50
* },
* "revision": "5",
* "rewardAvailable": true,
* "tier": {
* "points": 50,
* "_updatedDate": "2024-06-10T15:26:16.996Z"
* },
* "memberId": "bb3ed529-4722-440c-8a71-af808ffc12fd"
* },
* {
* "_createdDate": "2024-06-10T15:17:35.120Z",
* "_id": "866bdab0-d192-40f7-8821-fbfca2961c27",
* "_updatedDate": "2024-06-10T15:33:29.015Z",
* "contact": {
* "name": "Elena Rodriguez",
* "email": "elena.rodriguez@example.com",
* "displayName": "Elena Rodriguez",
* "_id": "2bb7d76e-de13-4909-ac12-8ab763d4b233"
* },
* "contactId": "2bb7d76e-de13-4909-ac12-8ab763d4b233",
* "lastActivityDate": "2024-06-10T15:31:02.699Z",
* "points": {
* "balance": 230,
* "earned": 50,
* "adjusted": 180,
* "redeemed": 0,
* "expired": 0
* },
* "pointsExpiration": {
* "expirationDate": "2024-09-10T15:17:35.538Z",
* "expiringPointsAmount": 230
* },
* "revision": "8",
* "rewardAvailable": true,
* "tier": {
* "points": 230,
* "_id": "b8501f07-a34f-4608-b9b0-168e6c6c505a",
* "_updatedDate": "2024-06-10T15:31:02.783Z"
* },
* "memberId": "2bb7d76e-de13-4909-ac12-8ab763d4b233"
* }
* ],
* "pagingMetadata": {
* "count": 5,
* "cursors": {},
* "hasNext": false
* }
* }
*/
```
---