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

Question: How do I get list of organizations a user is associated to #99

Closed
purimetla opened this issue Mar 6, 2020 · 3 comments
Closed

Comments

@purimetla
Copy link

Hey,
I'm using Github Enterprise and my use case is to get metrics using GitHub API. As part of this effort, I've a list of users to go against and fetch the necessary data for reporting and analysis.

I'm trying to get all the Organizations(public & private) each user belongs to and get all repositories within those organizations and get stats for each repository.

I tried using this method: octokit.orgs.listForUser({ username, per_page, page }); which results in only public orgs. Since it is enterprise GitHub server, all orgs are private and I'm unable user organizations.

Can you recommend/suggest if there is a way to fetch this data.

P.S: There seems to be an GitHub endpoint for this ask but this is only for an authenticated user.
https://developer.github.com/enterprise/2.20/v3/orgs/#list-your-organizations

@gr2m
Copy link
Contributor

gr2m commented Mar 9, 2020

The endpoint used for octokit.orgs.listForUser({ username, per_page, page }) is https://developer.github.com/v3/orgs/#list-user-organizations. The description states that the endpoint returns only the public memberships

List public organization memberships for the specified user

In order to get all organizations a user is associated with, you need to authenticate as that user, as far as I know.

Maybe there is an enterprise-only endpoint that can be used that I'm not aware of. Could you ask support about it? https://enterprise.githubsupport.com/hc/en-us/requests/new

@gr2m gr2m added the support label Mar 9, 2020
@purimetla
Copy link
Author

@gr2m

Thanks for your input and pointing me in the right direction. I've just submitted a request asking the same.

Regards
Anil

@gr2m
Copy link
Contributor

gr2m commented Mar 10, 2020

I'll close the issue for the time being as there is nothing actionable for me right now, but please let me know what support says, and reopen the issue if there is something I can help with from my side

@gr2m gr2m closed this as completed Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants