【问题标题】:Get all the COMMITS from all the repositories of an organization in Github using R使用 R 从 Github 中组织的所有存储库中获取所有 COMMITS
【发布时间】:2019-03-21 09:17:56
【问题描述】:

嘿,所以我在 R 中使用这一行:

request <- GET("https://<host-name>/api/v3/search/commits?=org:<org-Name>",
                add_headers(Authorization= "token <token number>",
 Accept= 'application/vnd.github.cloak-preview'))

结果我得到了这个:

]
  Date: 2019-03-21 09:13
  Status: 422
  Content-Type: application/json; charset=utf-8
  Size: 221 B
{
  "message": "Validation Failed",
  "errors": [
    {
      "resource": "Search",
      "field": "q",
      "code": "missing"
    }
  ],
  "documentation_url": "https://developer.github.com/enterprise/2...
...

它说缺少代码 在获取请求中,我必须编写一个查询语法,其中我将组织名称作为“q”参数传递,但是它说它缺少的代码是什么?

【问题讨论】:

标签: r api github get


【解决方案1】:

我找到了解决办法:

基本上在commits? 前面应该是commits?q= 但这也不起作用,因为它需要一个字符串字段所以:commits?q=stringfield+org:{org-name}

request <- GET("https://<host-name>/api/v3/search/commits?=org:<org-Name>",
                add_headers(Authorization= "token <token number>",
 Accept= 'application/vnd.github.cloak-preview'))

【讨论】:

  • 另外,您发布的 sn-p 与您描述的不符。 “字符串字段”是指实际的搜索词吗?
  • 是的,您似乎无法搜索没有字符串的提交。一个搜索词是的。就像一个字。但是现在我发现很难使用一个可以肯定地给我所有提交的字符串。因为这就是我想要的。所有存储库的所有提交。
  • 那你为什么要使用搜索 API 呢?如果你想要一个组织中所有 repos 的所有提交,你可能想点击developer.github.com/v3/repos/#list-organization-repositories 然后commits_url developer.github.com/v3/repos/commits/…
  • 这是常规 API。我正在使用具有其他文档的企业版 api。
  • 我认为这些是企业版的额外端点,它仍然公开了与托管版本相同的 API 的其余部分。
猜你喜欢
  • 2021-07-11
  • 2023-04-07
  • 1970-01-01
  • 2013-09-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-21
相关资源
最近更新 更多