Lists site members, given the provided paging and fieldsets.
PUBLIC
fieldset returns id
and profile
object. status
, privacyStatus
and activityStatus
are returned as UNKNOWN
.FULL
fieldset returns all fields.function listMembers(options: ListMembersOptions): Promise<ListMembersResponse>;
Options for paging, sorting, and specifying fields to return.
import { members } from "wix-members.v2";
import { webMethod, Permissions } from "wix-web-module";
/* Sample parameter values:
*
* {
* "options": {
* "fieldsets": ["EXTENDED"],
* "paging": {
* "limit": 20,
* "offset": 0
* },
* "sorting": [
* {
* "fieldName": "lastName",
* "order": "ASC"
* }
* ]
* }
* }
*/
export const myListMemberFunction = webMethod(
Permissions.Anyone,
async (options) => {
try {
const memberList = await members.listMembers(options);
console.log("Site members:", memberList);
return memberList;
} catch (error) {
console.error(error);
// Handle the error
}
},
);
/* Promise resolves to:
*
* {
* "members": [
* {
* "_createdDate": "2024-02-29T11:12:57.000Z",
* "_id": "29ae2752-73d2-4a07-8cba-677e1928ed52",
* "_updatedDate": "2024-02-29T11:12:57.474Z",
* "activityStatus": "ACTIVE",
* "contactId": "a2b3c4d5-1234-5678-9876-abcdef123456",
* "profile": {
* "nickname": "member1",
* "slug": "member1_1234"
* },
* "privacyStatus": "PUBLIC",
* "status": "VERIFIED"
* },
* {
* "_createdDate": "2024-02-29T11:12:57.000Z",
* "_id": "29ae2752-73d2-4a07-8cba-677e1928ed53",
* "_updatedDate": "2024-02-29T11:12:57.474Z",
* "activityStatus": "ACTIVE",
* "contactId": "a2b3c4d5-1234-5678-9876-abcdef123457",
* "profile": {
* "nickname": "member2",
* "slug": "member2_5678"
* },
* "privacyStatus": "PUBLIC",
* "status": "VERIFIED"
* },
* {
* "_createdDate": "2024-02-29T11:12:57.000Z",
* "_id": "29ae2752-73d2-4a07-8cba-677e1928ed54",
* "_updatedDate": "2024-02-29T11:12:57.474Z",
* "activityStatus": "ACTIVE",
* "contactId": "a2b3c4d5-1234-5678-9876-abcdef123458",
* "profile": {
* "nickname": "member3",
* "slug": "member3_9012"
* },
* "privacyStatus": "PUBLIC",
* "status": "VERIFIED"
* },
* {
* "_createdDate": "2024-02-29T11:12:57.000Z",
* "_id": "29ae2752-73d2-4a07-8cba-677e1928ed55",
* "_updatedDate": "2024-02-29T11:12:57.474Z",
* "activityStatus": "ACTIVE",
* "contactId": "a2b3c4d5-1234-5678-9876-abcdef123459",
* "profile": {
* "nickname": "member4",
* "slug": "member4_3456"
* },
* "privacyStatus": "PUBLIC",
* "status": "VERIFIED"
* }
* ],
* "metadata": {
* "count": 4,
* "offset": 0,
* "total": 4,
* "tooManyToCount": false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.