如何从github api获得组织成员

时间:2018-04-17 20:56:45

标签: curl github

我很困惑为什么我的卷曲:curl https://api.github.com/orgs/:org/members只返回一个长度为5的数组,当组织中有超过50人时?

当我执行curl https://api.github.com/orgs/:org/members?page=2时,它只返回[ ],表示没有更多?

这个人和成员的概念是不同于网站的api?

或者我需要做一些不同的事情才能获得所有成员吗?

1 个答案:

答案 0 :(得分:0)

documentation表示:

If the authenticated user is also a member of this organization then both concealed and public members will be returned.

因此,您可能需要进行身份验证才能列出组织中的所有用户。 您可以通过添加-u选项来完成此操作:

curl -u "username:password" https://api.github.com/orgs/:org/members

一般情况下,我建议在脚本中使用OAuth2令牌而不是Basic Auth。您可以阅读支持的身份验证方案here