【发布时间】:2013-10-19 14:45:39
【问题描述】:
我正在熟悉 GitHub API http://developer.github.com/v3/ 我正在尝试使用 Firefox 的 RESTClient 插件和 curl 命令行工具。
我已经找到了如何使用 API 创建 repo,但是我似乎无法使用 API 删除它。
根据此处的帮助:http://developer.github.com/v3/repos/#delete-a-repository 我必须发送这样的 DELETE 请求:
curl -X DELETE -H 'Authorization: token xxx' https://api.github.com/repos/:owner/:repo
帮助没有具体说明,我不确定 :owner 和 :repo 是什么意思 - 这些是名称还是 ID,但我尝试了几种组合的名称和 ID,但均未成功。我收到的回复是:
404 Not Found
我错过了什么?
【问题讨论】:
-
如果你有
github.com/foo/bar,那么:owner就是foo,:repo就是bar。 -
谢谢,但
curl -X DELETE -H 'Authorization: token xxx' https://api.github.com/repos/foo/bar还是不行 -
假凭证和不存在的 repo 会怎样?我明白了:
$ curl -X DELETE -H 'Authorization: token xxx' https://api.github.com/repos/foo/bar { "message": "Bad credentials", "documentation_url": "http://developer.github.com/v3" } -
我使用了正确的凭据。我把“xxx”放在这里只是作为一个占位符,因为我不想透露我的真实令牌。
-
是的,但是当你执行那个确切的请求时你会得到什么?你收到的错误信息和我一样,还是 404?
标签: github-api