使用Octokit,我可以遍历链接rels
以进入"组织"和"成员,"但我似乎无法找到"团队"任何地方。
我可以获得一个组织的代表,但链接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"}
答案 0 :(得分:0)
如果您阅读developer documentation的Organizations,则会发现端点为/orgs/:org_name/teams
。要获得您想要的个人团队/teams/:team_id
。
我现在看到您正在使用OAuth令牌(来自授权API)。您可能没有为令牌设置适当的范围。看一下list of scopes并注意您至少需要read:org
才能看到您的团队。