首页 > 解决方案 > 使用 R 从 Github 中组织的所有存储库中获取所有 COMMITS

问题描述

嘿,所以我在 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”参数传递,但是它说它缺少的代码是什么?

标签: rapigithubget

解决方案


我找到了一个解决方案:

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'))

推荐阅读