javascript - 在 github API 上访问 github 存储库的正确端点是什么?
问题描述
我正在向 github 的 API 发出请求以获取以下项目:repo 的名称、repo 所有者的名称、repo url、repo 描述、星数、许可证类型以及 repo 是否分叉。根据 github 的 API 文档,我有这个端点:https://api.github.com/search/repositories?q={query}{&page,per_page,sort,order}
但这似乎不起作用。我是不是忘记了什么?github API 在这里:https ://help.github.com/articles/searching-repositories 。这也是我提出的要求:
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
})
}
解决方案
为我工作。在这里,我在自述文件中搜索包含 Labyrinth 的 repos:
https://api.github.com/search/repositories?q=labyrinth+in:readme&type=repository
或者,如果您想要一个特定的 repo,请使用https://api.github.com/repos/:owner/:repo ,如下所示:
推荐阅读
- swift - 如何使用 openssl 获取自签名证书并在 URLSession 身份验证挑战中对其进行验证
- java - 如何在没有任何端口的情况下直接使用 url 访问我的 Spring Boot Web 应用程序?
- thymeleaf - 如何从 Thymeleaf 中的字符串中提取第一个字母?
- javascript - 从类转换为函数反应js
- django - Django 嵌套模型或序列化器
- java - 整数太大或长数太大
- python - 使用 tf.cond() 检查自定义层的调用方法中的条件
- java - 如何从新线程中的会话中删除属性?
- javascript - 正确的 HTML、CSS、JS、PHP 文件组织?
- xamarin.forms - PRISM for Xamarin Forms 是否支持新的基于 Shell/URI 的导航?