Get a list of all repositories where I'm a collaborator/invited #24514
-
Maybe someone can point me to where I’m going wrong here … API v3 documentation https://developer.github.com/v3/repos/ I have a user with access to three (3) repositories: R1 - NEW empty repo (testRepository) However, the API only return R1 and R2?
How do I get a list of all repositories where I’m not the owner but just a collaborator/invited? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 4 replies
-
Hi @aram535, Thank you for being here! I wonder if you are running into a pagination issue, could you try:
Results are returned in pages of 30 results by default, so you can follow the Link header to get the next page of results, and you can also add the per_page parameter to get more results. |
Beta Was this translation helpful? Give feedback.
-
Hi Andrea, It’s a rather small request at this point, only 3 should return. “type=all” should include any repositories that the user has been invited into, however only the 2 “owned” projects are returned. Here is the odd part:
but if you query the user itself: Only 2 repos are returned. I have verified it manually… and here it is programmatically:
Just as a test using V4 of the API I do get 3 repositories.
I get 3 repositories listed. |
Beta Was this translation helpful? Give feedback.
-
Hi @aram535, Are all the memberships public? If you don’t authenticate, that endpoint returns only organizations for which you publicized your membership, as explained in the documentation: https://developer.github.com/v3/orgs/#list-user-organizations Thought that doesn’t really explain how v4 is returning them all, let me look into this some more. I’ll reach out to that team and post any updates here. Thanks again for bringing this up to our attention. Best, Andrea |
Beta Was this translation helpful? Give feedback.
-
Hi Andrea, No, they’re not all public. Yes, I am authenticating using a token (same token). I don’t believe without authentication the 2nd endpoint would return anything at all correct? |
Beta Was this translation helpful? Give feedback.
-
Hi @aram535, You are correct, the authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. It would seem the simplest way in v3 is to use /user/repos: https://api.github.com/user/repos. I hope this helps! Best, Andrea |
Beta Was this translation helpful? Give feedback.
-
Is a Github Admin (within Github Enterprise), able to pull up all the memberships (public/private) for specific members? I’ve been banging my head against the V3 apis and can’t see to get all the repos returned, when I know a specific user (not me) has write access to it. |
Beta Was this translation helpful? Give feedback.
-
Hi @jonathanhle, welcome to the community! Thanks for your question. Users can publicize or hide organization membership. Hidden organization memberships are not visible in the GitHub Enterprise web interface unless your user, too, is a member of the organization, and they never appear in responses from the Organizations API’s List user organizations endpoint. In order to see someone’s hidden organization membership as a Site Administrator via the API, you’ll need to make a request to the Members API’s List your organization memberships endpoint and authenticate that request with an impersonation OAuth token. This will show all organization memberships, both public and hidden. When you’re done, we advise deleting the impersonation OAuth token. |
Beta Was this translation helpful? Give feedback.
Hi @jonathanhle, welcome to the community! Thanks for your question. Users can publicize or hide organization membership. Hidden organization memberships are not visible in the GitHub Enterprise web interface unless your user, too, is a member of the organization, and they never appear in responses from the Organizations API’s List user organizations endpoint.
In order to see someone’s hidden organization membership as a Site Administrator via the API, you’ll need to make a request to the Members API’s List your organization memberships endpoint and authenticate that request with an impersonation OAuth token. This will show all organization memberships, both public and hidden. When you’…