List Channel Members By Highest Role
    • Dark
      Light
    • PDF

    List Channel Members By Highest Role

    • Dark
      Light
    • PDF

    Article summary

    Get
    /api/v1/channels.membersByHighestRole

    Lists all channel users sorted by their room scoped roles.

    Room members are sorted by their most important role in the room. The following hierarchy is used: Owner > Moderator > Other roles. The information related to each user's highest role is returned in the highestRole object within each of them.

    The highestRole object contains a numeric level field which ranges from 0 to 2. Level 0 stands for room owners, while level 1 is assigned to moderators (that are not room owners) and level 2 is assigned to all other team members regardless of their room scoped roles.

    The highestRole object also contains a role field, which has three possile values: owner, moderator or member, which are assigned to levels 0, 1 and 2, respectively. The list of elements a user can use to sort the list is limited. The current sortable element is:username

    Changelog

    VersionDescription
    6.5.0Added
    Header parameters
    X-Auth-Token
    stringRequired

    The authToken of the authenticated user.

    ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
    X-User-Id
    stringRequired

    The userId of the authenticated user.

    ExamplerbAXPnMktTFbNpwtJ
    Query parameters
    status
    array of string

    The user's status (search filter).

    Example['online', 'away']
    roomId
    string

    The room id. It is required if the roomName is not provided.

    Exampledlpfuijw7ej
    roomName
    string

    The room name. It is required if the roomId is not provided.

    Examplegeneral
    filter
    string

    Extra search filters to be applied to the fields defined in the Accounts_SearchFields setting.

    count
    integer

    The number of items to return.

    Example50
    sort

    List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, {"value": -1, "_id": 1}

    offset
    integer

    Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items.

    Example50
    Responses
    200

    OK

    Example
    {
      "members": [
        {
          "_id": "JmR3T4TFfppJCfmq9",
          "status": "offline",
          "_updatedAt": "2023-07-20T20:43:05.895Z",
          "name": "Matheus Barbosa Silva",
          "statusConnection": "offline",
          "username": "matheus.barbosa",
          "avatarETag": "fdJn5SqCwg4ZwbywD",
          "highestRole": {
            "role": "owner",
            "level": 0
          }
        },
        {
          "_id": "edjvbnb7pGC3MZNSP",
          "status": "offline",
          "_updatedAt": "2023-07-17T21:42:31.845Z",
          "username": "john",
          "name": "John",
          "statusConnection": "offline",
          "highestRole": {
            "role": "member",
            "level": 2
          }
        }
      ],
      "count": 2,
      "offset": 0,
      "total": 35,
      "success": true
    }
    Expand All
    object
    members
    Array of object
    object
    _id
    string
    status
    string
    _updatedAt
    string
    name
    string
    statusConnection
    string
    username
    string
    avatarETag
    string
    highestRole
    object
    role
    string
    level
    integer
    count
    integer
    offset
    integer
    total
    integer
    success
    boolean

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.