-->

Yammer API - List of groups for each user

2019-05-25 21:16发布

问题:

I would like to get the list of groups that every user in the yammer instance belongs to. Currently it looks like the user object from both the data export API and the REST API do not contain a section with which groups each user belongs to. I know that there is a way to see what groups I belong to in the REST API, but that does not seem to give the groups for every user in the yammer instance.

Does anybody know if there is a way to get the list of all groups that each and every user in the yammer instance belongs to using either of the APIs?

Thanks!

回答1:

I found that if you have the full list of group IDs (either from the data export api or the rest api), you can use those group IDs to individually query, and page through the following endpoint on the REST API.

https://www.yammer.com/api/v1/users/in_group/[group_id].json?page=[page_number]



回答2:

A fairly easy way to do this would be to get the list of groups:

https://www.yammer.com/api/v1/groups.json

And then iterate over the group IDs returned to get the list of members of each group:

https://www.yammer.com/api/v1/groups/{group id}/members.json

Bear in mind, unless you have proper access you may not be able to see into private groups to get the list of members.



标签: yammer