Search.../

listMembers( )

Developer Preview

Lists site members, given the provided paging and fieldsets.

Description

  • PUBLIC fieldset returns id and profile object. status, privacyStatus and activityStatus are returned as UNKNOWN.
  • FULL fieldset returns all fields.

Syntax

function listMembers(options: ListMembersOptions): Promise<ListMembersResponse>

listMembers Parameters

NAME
TYPE
DESCRIPTION
options
Optional
ListMembersOptions

Options for paging, sorting, and specifying fields to return.

Returns

Return Type:

Promise<
ListMembersResponse
>
NAME
TYPE
DESCRIPTION
members
Array<
Member
>

List of members.

metadata
PagingMetadata

Metadata for the paginated results.

Was this helpful?

List all site members with full parameters (export from backend code)

Copy Code
1import { members } from 'wix-members.v2';
2import { webMethod, Permissions } from 'wix-web-module';
3
4/* Sample parameter values:
5 *
6 * {
7 * "options": {
8 * "fieldsets": ["EXTENDED"],
9 * "paging": {
10 * "limit": 20,
11 * "offset": 0
12 * },
13 * "sorting": [
14 * {
15 * "fieldName": "lastName",
16 * "order": "ASC"
17 * }
18 * ]
19 * }
20 * }
21 */
22
23export const myListMemberFunction = webMethod(
24 Permissions.Anyone,
25 async (options) => {
26 try {
27 const memberList = await members.listMembers(options);
28 console.log('Site members:', memberList);
29
30 return memberList;
31 } catch (error) {
32 console.error(error);
33 // Handle the error
34 }
35 }
36);
37
38/* Promise resolves to:
39 *
40 * {
41 * "members": [
42 * {
43 * "_createdDate": "2024-02-29T11:12:57.000Z",
44 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed52",
45 * "_updatedDate": "2024-02-29T11:12:57.474Z",
46 * "activityStatus": "ACTIVE",
47 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123456",
48 * "profile": {
49 * "nickname": "member1",
50 * "slug": "member1_1234"
51 * },
52 * "privacyStatus": "PUBLIC",
53 * "status": "VERIFIED"
54 * },
55 * {
56 * "_createdDate": "2024-02-29T11:12:57.000Z",
57 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed53",
58 * "_updatedDate": "2024-02-29T11:12:57.474Z",
59 * "activityStatus": "ACTIVE",
60 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123457",
61 * "profile": {
62 * "nickname": "member2",
63 * "slug": "member2_5678"
64 * },
65 * "privacyStatus": "PUBLIC",
66 * "status": "VERIFIED"
67 * },
68 * {
69 * "_createdDate": "2024-02-29T11:12:57.000Z",
70 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed54",
71 * "_updatedDate": "2024-02-29T11:12:57.474Z",
72 * "activityStatus": "ACTIVE",
73 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123458",
74 * "profile": {
75 * "nickname": "member3",
76 * "slug": "member3_9012"
77 * },
78 * "privacyStatus": "PUBLIC",
79 * "status": "VERIFIED"
80 * },
81 * {
82 * "_createdDate": "2024-02-29T11:12:57.000Z",
83 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed55",
84 * "_updatedDate": "2024-02-29T11:12:57.474Z",
85 * "activityStatus": "ACTIVE",
86 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123459",
87 * "profile": {
88 * "nickname": "member4",
89 * "slug": "member4_3456"
90 * },
91 * "privacyStatus": "PUBLIC",
92 * "status": "VERIFIED"
93 * }
94 * ],
95 * "metadata": {
96 * "count": 4,
97 * "offset": 0,
98 * "total": 4,
99 * "tooManyToCount": false
100 * }
101 * }
102 */
List site members with no options parameters (export from backend code)

Copy Code
1import { members } from 'wix-members.v2';
2import { webMethod, Permissions } from 'wix-web-module';
3
4/* Sample options value
5 *
6 * {
7 * "options": null
8 * }
9 */
10
11export const myListMemberFunction = webMethod(
12 Permissions.Anyone,
13 async (options) => {
14 try {
15 const memberList = await members.listMembers(options);
16 console.log('Site members:', memberList);
17
18 return memberList;
19 } catch (error) {
20 console.error(error);
21 // Handle the error
22 }
23 }
24);
25
26/* Promise resolves to:
27 *
28 * {
29 * "members": [
30 * {
31 * "_createdDate": "2024-02-29T11:12:57.000Z",
32 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed52",
33 * "_updatedDate": "2024-02-29T11:12:57.474Z",
34 * "activityStatus": "ACTIVE",
35 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123456",
36 * "profile": {
37 * "nickname": "member1",
38 * "slug": "member1_1234"
39 * },
40 * "privacyStatus": "PUBLIC",
41 * "status": "VERIFIED"
42 * },
43 * {
44 * "_createdDate": "2024-02-29T11:12:57.000Z",
45 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed53",
46 * "_updatedDate": "2024-02-29T11:12:57.474Z",
47 * "activityStatus": "ACTIVE",
48 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123457",
49 * "profile": {
50 * "nickname": "member2",
51 * "slug": "member2_5678"
52 * },
53 * "privacyStatus": "PUBLIC",
54 * "status": "VERIFIED"
55 * },
56 * {
57 * "_createdDate": "2024-02-29T11:12:57.000Z",
58 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed54",
59 * "_updatedDate": "2024-02-29T11:12:57.474Z",
60 * "activityStatus": "ACTIVE",
61 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123458",
62 * "profile": {
63 * "nickname": "member3",
64 * "slug": "member3_9012"
65 * },
66 * "privacyStatus": "PUBLIC",
67 * "status": "VERIFIED"
68 * },
69 * {
70 * "_createdDate": "2024-02-29T11:12:57.000Z",
71 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed55",
72 * "_updatedDate": "2024-02-29T11:12:57.474Z",
73 * "activityStatus": "ACTIVE",
74 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123459",
75 * "profile": {
76 * "nickname": "member4",
77 * "slug": "member4_3456"
78 * },
79 * "privacyStatus": "PUBLIC",
80 * "status": "VERIFIED"
81 * }
82 * ],
83 * "metadata": {
84 * "count": 4,
85 * "offset": 0,
86 * "total": 4,
87 * "tooManyToCount": false
88 * }
89 * }
90 */
List site members (dashboard page code)

Copy Code
1import { members } from 'wix-members.v2';
2
3/* Sample options value
4 *
5 * {
6 * "options": null
7 * }
8 */
9
10export async function myListMemberFunction(options){
11 try {
12 const memberList = await members.listMembers(options);
13 console.log('Site members:', memberList);
14
15 return memberList;
16 } catch (error) {
17 console.error(error);
18 // Handle the error
19 }
20};
21
22/* Promise resolves to:
23 *
24 * {
25 * "members": [
26 * {
27 * "_createdDate": "2024-02-29T11:12:57.000Z",
28 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed52",
29 * "_updatedDate": "2024-02-29T11:12:57.474Z",
30 * "activityStatus": "ACTIVE",
31 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123456",
32 * "profile": {
33 * "nickname": "member1",
34 * "slug": "member1_1234"
35 * },
36 * "privacyStatus": "PUBLIC",
37 * "status": "VERIFIED"
38 * },
39 * {
40 * "_createdDate": "2024-02-29T11:12:57.000Z",
41 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed53",
42 * "_updatedDate": "2024-02-29T11:12:57.474Z",
43 * "activityStatus": "ACTIVE",
44 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123457",
45 * "profile": {
46 * "nickname": "member2",
47 * "slug": "member2_5678"
48 * },
49 * "privacyStatus": "PUBLIC",
50 * "status": "VERIFIED"
51 * },
52 * {
53 * "_createdDate": "2024-02-29T11:12:57.000Z",
54 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed54",
55 * "_updatedDate": "2024-02-29T11:12:57.474Z",
56 * "activityStatus": "ACTIVE",
57 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123458",
58 * "profile": {
59 * "nickname": "member3",
60 * "slug": "member3_9012"
61 * },
62 * "privacyStatus": "PUBLIC",
63 * "status": "VERIFIED"
64 * },
65 * {
66 * "_createdDate": "2024-02-29T11:12:57.000Z",
67 * "_id": "29ae2752-73d2-4a07-8cba-677e1928ed55",
68 * "_updatedDate": "2024-02-29T11:12:57.474Z",
69 * "activityStatus": "ACTIVE",
70 * "contactId": "a2b3c4d5-1234-5678-9876-abcdef123459",
71 * "profile": {
72 * "nickname": "member4",
73 * "slug": "member4_3456"
74 * },
75 * "privacyStatus": "PUBLIC",
76 * "status": "VERIFIED"
77 * }
78 * ],
79 * "metadata": {
80 * "count": 4,
81 * "offset": 0,
82 * "total": 4,
83 * "tooManyToCount": false
84 * }
85 * }
86 */