使用Octokit,我可以遍历链接rels
以获得"组织"one_answers"成员",但我似乎无法在任何地方找到"团队"。
我可以得到一个组织的表示,但链接rels
不包括任何团队
curl -H "Authorization: token $OAUTHTOKEN" https://api.github.com/orgs/MY_ORG
给我
{
"login": "…",
"id": …,
"url": "https://api.github.com/orgs/MY_ORG",
"repos_url": "https://api.github.com/orgs/MY_ORG/repos",
"events_url": "https://api.github.com/orgs/MY_ORG/events",
"members_url": "https://api.github.com/orgs/MY_ORG/members{/member}",
"public_members_url": "https://api.github.com/orgs/MY_ORG/public_members{/member}"
…
}
Octokit也得到了类似的结果:
client = Octokit::Client.new access_token: ENV['GITHUB_ACCESS_TOKEN']
my_org = client.org 'MY_ORG'
my_org.rels
{:self_url=>"https://api.github.com/orgs/MY_ORG",
:repos_url=>"https://api.github.com/orgs/MY_ORG/repos",
:events_url=>"https://api.github.com/orgs/MY_ORG/events",
:members_url=>"https://api.github.com/orgs/MY_ORG/members",
:public_members_url=>"https://api.github.com/orgs/MY_ORG/public_members",
:avatar_url=>"…",
:html_url=>"https://github.com/MY_ORG"}
如果您阅读组织的开发人员文档,您将看到端点是/orgs/:org_name/teams
。要获得个人团队,您需要/teams/:team_id
。
我现在看到你正在使用OAuth令牌(来自授权API)。您可能没有为令牌设置适当的作用域。查看一下作用域列表,并注意您可能至少需要read:org
才能看到您的团队。