我想从我的帐户中获取所有作为模板的仓库。
我尝试根据此https://docs.github.com/en/rest/reference/repos#get-a-repository提取单个存储库
然后按照文档中所述通过“ is_template”键过滤响应。
问题是不要在响应中得到该字段,其他值也可以。
这是我的请求:https://api.github.com/repos/my-account/test
我已通过身份验证,我使用自己的帐户,我尝试获取自己的存储库。
问题:
答案 0 :(得分:0)
我相信您需要选择加入预览标头才能在响应中接收新的is_template
字段。
此curl请求对我有用:
$ curl -s -H "Accept: application/vnd.github.baptiste-preview+json" https://api.github.com/repos/octokit/octokit.net | grep "is_template"
"is_template": false,
而这个不返回任何输出:
curl -s https://api.github.com/repos/octokit/octokit.net | grep "is_template"