Query Community Members
Last updated
Was this helpful?
Last updated
Was this helpful?
To retrieve a list of community members, users can call the relevant method and provide the desired membership options and sorting parameters. For example, they may choose to sort the list of members by name or by date created, or they may specify certain membership options, such as only retrieving members who are not banned. The result of the method will always return as .
To query community members with certain criteria, the following parameters are used:
membershipOptions
: allows users to filter the results based on the membership status of community members. Passing an empty option or not passing an option set for membershipOptions
parameter will default to member
.
member
- will filter out all banned members and only include unbanned members.
ban
- will only include banned members in the results.
roles
: allows users to query for members with default moderator roles by using "channel-moderator" or "community-moderator" as the value. At this moment, we do not have a way to query for member-only roles. For custom roles assigned to members, users can pass in roleId
of the custom role to filter members by this role.
includeDeleted
: A parameter accepting a boolean value.
true
-> include a member whose user has been deleted
false
-> exclude member whose user has been deleted
sortBy
: allows users to specify the sorting method for the returned collection. The possible values include displayName
, firstCreated
, lastCreated
. The firstCreated
sort option will be specified by default if it isn't specified. When a keyword is provided, leading to a list sorted by search rank.
If no keyword is supplied, the list of users for the specified community will be sorted by the date they joined.
To search for community members with certain criteria, the following parameters are used:
keyword
: allows users to specify the keyword to search for. The result contains members with either matching displayName
or userId
membershipOptions
: allows users to filter the results based on the membership status of community members. Passing an empty option or not passing and option set for membershipOptions
parameter will default to member
.
member
- will filter out all banned members and only include unbanned members.
ban
- will only include banned members in the results.
roles
: allows users to query for members with default moderator roles by using "channel-moderator" or "community-moderator" as the value. At this moment, we do not have a way to query for member-only roles. For custom roles assigned to members, users can pass in the roleId
of the custom role to filter members by this role.
includeDeleted
: A parameter accepting a boolean value.
true
-> include a member whose user has been deleted
false
-> exclude member whose user has been deleted
sortBy
: allows users to specify the sorting method for the returned collection. The possible values include displayName
, firstCreated
, lastCreated
. The displayName
sort option will be specified by default if it isn't specified. When a keyword is provided, leading to a list sorted by search rank.
To search for community members, users can call the relevant method and provide the desired keyword, roles, and membership options parameters. For example, they may specify certain membership options, such as only retrieving members who are not banned. The result of the method will always return as .