Get Users in Group

Get all users of a Nextcloud group

Script nextcloud

by nextcloud ยท 2/20/2025

  • Submitted by nextcloud Bun
    Created 86 days ago
    1
    import axios from "axios";
    2
    
    
    3
    export async function main(
    4
        nextcloud: RT.Nextcloud,
    5
        groupId: string,
    6
    ) {
    7
    
    
    8
        const res = await axios.get(
    9
            `${nextcloud.baseUrl}/ocs/v2.php/cloud/groups/${groupId}`,
    10
            {
    11
                auth: {
    12
                    username: nextcloud.userId,
    13
                    password: nextcloud.token,
    14
                },
    15
                headers: {
    16
                    'OCS-APIRequest': 'true',
    17
                },
    18
            }
    19
        );
    20
    
    
    21
        return res.data.ocs.data.users
    22
    }
    23