Search code examples
apiyammer

API REST Yammer: cant retrieve admins from a group


using the REST API i did that with the JavaScript SDK :

yam.platform.request({
    url: "users/in_group/2490226",
    method: "GET",
});

I retrieved users but I can't see which one is an admin

Can I retrive the admins of a group using the REST API?


Solution

  • If you use the group/{group id}/members.json call, the list of returned users will include the "is_group_admin" field.

    Here is an example: https://www.yammer.com/api/v1/groups/4767132/members.json

    4767132 is your groupID. The json response will include a list of users where a single user record looks like this:

        {
            "type": "user",
            "id": 1526232831,
            "name": "yam5dummy",
            "state": "active",
            "full_name": "yam5dummy",
            "job_title": null,
            "network_id": XXXXXX,
            "mugshot_url": "https://mug0.assets-yammer.com/mugshot/images/48x48/no_photo.png",
            "mugshot_url_template": "https://mug0.assets-yammer.com/mugshot/images/{width}x{height}/no_photo.png",
            "url": "https://www.yammer.com/api/v1/users/1526232831",
            "web_url": "https://www.yammer.com/XXXXX.com/users/1526232831",
            "activated_at": "2014/10/01 16:12:03 +0000",
            "auto_activated": false,
            "stats": {
                "following": 1,
                "followers": 1,
                "updates": 0
            },
            "email": "[email protected]",
            "is_group_admin": true,
            "group_member": {
                "state": "approved"
            }
        },
    

    Notice the "is_group_admin": true,