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

Retrieve repository info using repo id instead of using username and reponame #283

Closed
prasadsurase opened this issue Sep 16, 2016 · 7 comments

Comments

@prasadsurase
Copy link
Contributor

Hi

I am using github_api(0.14.5) to retrieve some details of a github repository. The issue is that I can't fetch the updated info of the same repository because it has been transferred to some other user.

2.3.0 :005 > user.gh_client.class
 => Github::Client 
2.3.0 :006 > user.gh_client.repos.class
 => Github::Client::Repos
2.3.0 :007 > m = user.gh_client.repos.method :get
 => #<Method: Github::Client::Repos#get(get_with_callback_repos)> 
2.3.0 :008 > m.source_location
 => ["/Users/prasad/.rvm/gems/ruby-2.3.0/gems/github_api-0.14.5/lib/github_api/api.rb", 185]
2.3.0 :009 > info = user.gh_client.repos.get 'prasadsurase', 'code-curiosity'
=> #some info
2.3.0 :010 >  info.class
 => Github::ResponseWrapper

The get method only takes the username and the reponame. It uses /repos/{username}/{reponame} api to retrieve the data. We can retrieve the same data using /repositories/{repo-id}. I was wondering if there exists a way to retrieve an repo's info using only its id. You can use /repos/prasadsurase/code-curiossity and /repositories/67219068 for comparision. If there isn't, I can send out an PR for the same.

Thanks.

@Shwetakale
Copy link
Contributor

@prasadsurase I was trying to find out this API's documentation here but I didn't find one. Could you please also paste documentation url here?

@PatWie
Copy link

PatWie commented Sep 22, 2016

This is the same as in #282. It is undocumented. However, it is probably the most useful api-query.

@Shwetakale
Copy link
Contributor

@PatWie Yes this is very useful API but I am wondering why GitHub has not documented or released it.

I think opening support ticket to GitHub and will be good idea and I experienced that their support team is very much active so they might solve our query. If they start supporting this officially then it would be helpful.

@prasadsurase
Copy link
Contributor Author

@Shwetakale @PatWie It was some pure luck on stumbling the second way to retrieve repository details. We use this to list all public repos. I just added the repo id and gave it a try. Have contacted Github Support regarding the same.

@Shwetakale
Copy link
Contributor

Shwetakale commented Sep 22, 2016

@prasadsurase 👍 I hope github releases this API officially.

@prasadsurase
Copy link
Contributor Author

As per Github, "Thanks for reaching out. Indeed that is undocumented, but that's intentional for now. We'll be documenting that endpoint in the future (actually, it's not just that endpoint, you can replace a name with the ID for most other endpoints), but I can't promise when it will happen. Still, you can rely on this behavior in your scripts and applications -- we don't have any plans on changing it."

@piotrmurach
Copy link
Owner

Merged.

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

4 participants