Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the move of the GitHub Teams API #1387

Closed
jcudit opened this issue Jan 20, 2020 · 13 comments · Fixed by #1400
Closed

Support the move of the GitHub Teams API #1387

jcudit opened this issue Jan 20, 2020 · 13 comments · Fixed by #1400
Assignees

Comments

@jcudit
Copy link

jcudit commented Jan 20, 2020

Over in https://github.com/terraform-providers/terraform-provider-github/issues/323, there has been some breakage due to GitHub moving the top-level /teams endpoint to live under /organizations/:org_id/team. v28.0.0 of this codebase is used for the GitHub Terraform provider, which is affected by the change.

$ go test -v -timeout 30m  ./... -run TestAccGithubTeamMembership_basic
...
2020/01/17 20:22:46 [DEBUG] Github API Request Details:
---[ REQUEST ]---------------------------------------
GET /teams/3606334/memberships/fuzzoli87 HTTP/1.1
Host: api.github.com
User-Agent: go-github
Accept: application/vnd.github.hellcat-preview+json
Accept-Encoding: gzip


-----------------------------------------------------
2020/01/17 20:22:46 [DEBUG] Sleeping 1s between write operations
2020/01/17 20:22:47 [DEBUG] Github API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 404 Not Found
Transfer-Encoding: chunked
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Content-Security-Policy: default-src 'none'
Content-Type: application/json; charset=utf-8
Date: Sat, 18 Jan 2020 01:22:47 GMT
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Server: GitHub.com
Status: 404 Not Found
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Accepted-Oauth-Scopes: repo
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Github-Media-Type: github.v3; param=hellcat-preview; format=json
X-Github-Request-Id: FABE:4655:15D7FC:29DF1A:5E225DE6
X-Oauth-Scopes: admin:gpg_key, admin:org, admin:public_key, admin:repo_hook, delete_repo, repo, user
X-Ratelimit-Limit: 5000
X-Ratelimit-Remaining: 4961
X-Ratelimit-Reset: 1579312573
X-Xss-Protection: 1; mode=block

70
{
 "message": "Not Found",
 "documentation_url": "https://developer.github.com/v3/teams/members/#get-team-membership"
}

I suspect https://github.com/google/go-github/blob/master/github/teams.go will need updates as well to cope with the changes.

cc https://github.com/github/ecosystem-api/issues/1836

@jcudit jcudit changed the title Team API changes causing 404s GitHub Team API changes causing 404s Jan 20, 2020
@dbussink
Copy link

To clarify here, the library is not currently broken, the above 404 is very likely because the given user is no longer a member of that team anymore.

We should though longer term move to the new API endpoints as the current ones are deprecated and will at some point in the future disappear and be only available under the new endpoints. So no immediate rush, but something to do in the future.

@gmlewis
Copy link
Collaborator

gmlewis commented Jan 20, 2020

I'm surprised I missed GitHub Developer announcements in their blog posts that the APIs were moving.

This issue would be a great opportunity for a new Go developer or someone new to our repo to investigate the change of the API endpoints mentioned above and to bring them up-to-date.
All contributions are greatly appreciated!

Feel free to volunteer for any issue and the issue can be assigned to you so that others don't attempt to duplicate the work.

Please check out our CONTRIBUTING.md guide to get started.

Thank you!

@sprsld
Copy link
Contributor

sprsld commented Jan 20, 2020

I would like to contribute to this issue.

@gmlewis
Copy link
Collaborator

gmlewis commented Jan 20, 2020

Thank you, @Atorr !
It is yours.

@sprsld
Copy link
Contributor

sprsld commented Jan 21, 2020

Not the most familiar, but in this case do we want to preserve implementation for legacy endpoints or delete them?

@gmlewis
Copy link
Collaborator

gmlewis commented Jan 21, 2020

Since this repo is versioned, we can go ahead and delete them. Thank you!

@dbussink
Copy link

I'm surprised I missed GitHub Developer announcements in their blog posts that the APIs were moving.

@gmlewis That's because the announcement didn't happen yet, and is in progress 😄. The confusion here originally started since an unrelated issue somewhere else was incorrectly thought to also affect this library. So that's why there was basically a premature issue opened here and why you didn't read about this yet 😄.

@gmlewis
Copy link
Collaborator

gmlewis commented Jan 21, 2020

OK, thank you, @dbussink! That explains it. 😄

I try to stay on top of the GitHub Developer announcements via RSS and Feedly - (I wish I could subscribe via email to the announcements... is there an easy way to do that?).

Anyway, thanks for the info!

@dbussink
Copy link

OK, thank you, @dbussink! That explains it. 😄

@gmlewis Wanted to let you know that the post is up now at https://developer.github.com/changes/2020-01-21-moving-the-team-api-endpoints/ 😄.

@gmlewis
Copy link
Collaborator

gmlewis commented Jan 23, 2020

Thanks again, @dbussink !

@Atorr - as you work through the PR, please check back to the GitHub Developer blog
post
to make sure that you've addressed all the (re)moved endpoints.

Thank you!

@weeco
Copy link

weeco commented Jan 26, 2020

@Atorr Since this issue is assigned to you I won't start working on a PR for the changes either, please let us know in case you can't continue working on this.

@gmlewis gmlewis changed the title GitHub Team API changes causing 404s Support the move of the GitHub Teams API Jan 26, 2020
@gmlewis
Copy link
Collaborator

gmlewis commented Jan 29, 2020

Since this issue is a big one, let's make a list of what needs to be done, which will help to keep things organized.

Endpoints to be deleted:

  • GET /teams/:team_id
  • PATCH /teams/:team_id
  • DELETE /teams/:team_id
  • GET /teams/:team_id/teams
  • GET /teams/:team_id/repos
  • GET /teams/:team_id/repos/:owner/:repo
  • PUT /teams/:team_id/repos/:owner/:repo
  • DELETE /teams/:team_id/repos/:owner/:repo
  • GET /teams/:team_id/projects
  • GET /teams/:team_id/projects/:project_id
  • PUT /teams/:team_id/projects/:project_id
  • DELETE /teams/:team_id/projects/:project_id

New endpoints to be added:

  • GET /orgs/:org/teams/:team_slug
  • GET /organizations/:org_id/team/:team_id
  • PATCH /orgs/:org/teams/:team_slug
  • PATCH /organizations/:org_id/team/:team_id
  • DELETE /orgs/:org/teams/:team_slug
  • DELETE /organizations/:org_id/team/:team_id
  • GET /orgs/:org/teams/:team_slug/teams
  • GET /organizations/:org_id/team/:team_id/teams
  • GET /orgs/:org/teams/:team_slug/repos
  • GET /organizations/:org_id/team/:team_id/repos
  • GET /orgs/:org/teams/:team_slug/repos/:owner/:repo
  • GET /organizations/:org_id/team/:team_id/repos/:owner/:repo
  • PUT /orgs/:org/teams/:team_slug/repos/:owner/:repo
  • PUT /organizations/:org_id/team/:team_id/repos/:owner/:repo
  • DELETE /orgs/:org/teams/:team_slug/repos/:owner/:repo
  • DELETE /organizations/:org_id/team/:team_id/repos/:owner/:repo
  • GET /orgs/:org/teams/:team_slug/projects
  • GET /organizations/:org_id/team/:team_id/projects
  • GET /orgs/:org/teams/:team_slug/projects/:project_id
  • GET /organizations/:org_id/team/:team_id/projects/:project_id
  • PUT /orgs/:org/teams/:team_slug/projects/:project_id
  • PUT /organizations/:org_id/team/:team_id/projects/:project_id
  • DELETE /orgs/:org/teams/:team_slug/projects/:project_id
  • DELETE /organizations/:org_id/team/:team_id/projects/:project_id

@sprsld
Copy link
Contributor

sprsld commented Jan 29, 2020

@weeco - Wrapping up some changes per PR reviews. I should still be able to close this out. Thanks though!

gmlewis pushed a commit that referenced this issue Feb 10, 2020
n1lesh pushed a commit to n1lesh/go-github that referenced this issue Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants