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

Get repo by ID #163

Closed
MitchK opened this issue Jun 26, 2014 · 4 comments
Closed

Get repo by ID #163

MitchK opened this issue Jun 26, 2014 · 4 comments

Comments

@MitchK
Copy link

MitchK commented Jun 26, 2014

The endpoint /repositories/:id is not documented on GitHub, but it is available.

Example: https://api.github.com/repositories/20633049

Also PyGithub uses this (https://github.com/jacquev6/PyGithub/blob/b64b0d6942bb27095bd035b8c0db10ca35448be3/github/MainClass.py) and I would like to also have it for Node.js

We need this, because the user/repo is not a good identifier for a unique repo, since repo names can be changed, username can be changed and ownership can be moved.

@busch-matthias
Copy link

Is there a reason why this Issue was closed ?
I might miss something obvious but at the moment you can not do it wiht octokit/rest?
See https://octokit.github.io/rest.js/#api-Repos-get

I would love this feature as well + I also stumbled upon piotrmurach/github#283 (comment)
So can someone confirm that it is not possible and/ or won't added to octokit/rest ?

@gr2m
Copy link
Contributor

gr2m commented Dec 26, 2018

Hi @Londane

You can get a repository by ID using octokit.request

octokit.request('GET /repositories/:id', {id})

See the "BREAKING CHANGES" section for the v16 release.

We removed a dedicated method because it’s not documented on https://developer.github.com/v3/ either. I think it’s being discussed to make it "official" as integrators depend on it, once it does, we will add a method again.

If you want to add the previous method back, you can do it using a plugin

const Octokit = require('@octokit/plugin')
  .plugin((octokit) => {
    octokit.registerEndpoints({
      repos: {
        getById: {
          method: 'GET',
          url: '/repositories/:id',
          params: {
            id: {
              type: 'string',
              required: true
            }
          }
        }
      }
    })
  })

const octokit = new Octokit()

octokit.repos.getById({id: 123})

@busch-matthias
Copy link

busch-matthias commented Dec 28, 2018

Hi @Londane

You can get a repository by ID using octokit.request
...

Thank your very much for your help!
Your code will help me a lot!

@SpencerKaiser
Copy link

@gr2m for what it's worth, I desperately needed /repositories/:id last year for a company event and had no idea that it existed until now... if you have some situation where you are monitoring a set of repos, you totally lose access to a repo if the name is changed, so retrieving by ID is the only real way around that. I would love to see this functionality re-introduced and see the docs updated...

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