0

Using Octokit, I can traverse link rels to get to "organization" and "members," but I can't seem to find "teams" anywhere.

I can get a representation of an org, but the link rels don't include anything for team

curl -H "Authorization: token $OAUTHTOKEN" https://api.github.com/orgs/MY_ORG

gives me

{ "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 nets similar results:

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"}

Jon Wolski
  • 2,293
  • 2
  • 19
  • 21

1 Answers1

0

If you read the developer documentation for Organizations you'll see that the endpoint is /orgs/:org_name/teams. To get an individual team you want /teams/:team_id.


I see now that you're using an OAuth Token (from the Authorizations API). You likely don't have the proper scopes set for the token. Take a look at the list of scopes and note that you probably at least nead read:org to see your teams.

Ian Stapleton Cordasco
  • 26,944
  • 4
  • 67
  • 72
  • Yes, this shows me where I could find the IDs of my org's teams, and where I can fetch representations of the teams by ID, but I can't find a link relation or URI template. That is, I can hard-code to the URL `/orgs/:org_name/teams` and the hard-code templating a `/teams/:team_id` URL, but I would prefer hard-coding only to link relations and a single base URL. I can get from orgs to repos, events, and members, but teams seem to be missing. ```sh – Jon Wolski Jul 22 '14 at 03:50
  • Thanks, @sigmavirus24. I updated my token to have every privilege, but again found no teams in the org. I did, however find that I can get to `teams` from `repos`. Even though the documentation shows a `/teams/:team_id/`, in actuality, this must be prepended with a repo path. – Jon Wolski Jul 24 '14 at 12:53