简体   繁体   English

在github API上访问github仓库的正确端点是什么?

[英]What's the correct endpoint to access github repositories on github API?

I'm doing a request to github's API to get the following items: the repo's name, the repo owner's name, the repo url, the repo description, the number of stars, the license type, and if the repo is forked or not. 我正在向github的API发出请求,以获取以下各项:回购的名称,回购所有者的名称,回购网址,回购描述,星号,许可证类型以及回购是否为分叉。 I have this endpoint according to github's API docs: https://api.github.com/search/repositories?q={query}{&page,per_page,sort,order} 根据github的API文档,我有这个端点: https ://api.github.com/search/repositories?q ={ query }{& page,per_page,sort,order }

But that doesn't seem to work. 但这似乎不起作用。 Did I forget something? 我忘记了什么吗? the github API is here: https://help.github.com/articles/searching-repositories . github API在这里: https : //help.github.com/articles/searching-repositories Also here is the request I'm making: 这也是我的要求:

     getRepos = (repoinfo) => {
        return fetch(`https://api.github.com/search/repositories?q={query} {&page,per_page,sort,order}`)
        .then(respone => Response.json())
        .then(response => {
          return response
        })
     }

Works for me. 为我工作。 Here I search for the repos containing Labyrinth in the readme: 在这里,我在自述文件中搜索包含迷宫的存储库:

https://api.github.com/search/repositories?q=labyrinth+in:readme&type=repository https://api.github.com/search/repositories?q=labyrinth+in:readme&type=repository

Or, if you want a specfific repo, use https://api.github.com/repos/:owner/:repo like this: 或者,如果您想要特定的回购协议,请使用https://api.github.com/repos/:owner/:repo这样:

https://api.github.com/repos/draluy/labyrinth https://api.github.com/repos/draluy/labyrinth

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM