Github API 错误 - { "message" : "Not Found" , "documentation_url" : "https://developer.github.com/v3"



api 是 v3,我尝试制作一个工具的原因,以便当您输入 github 的用户名和密码以及存储库名称和描述时,它将初始化存储库并为您提供 URL。我的输入是这样的——

curl -u {myuser}:{mypassword} -H "Content-Type: application/json" -d '{"name":"api-test","description":"made with github api","homepage": "https://github.com","private":true}' POST https://api.github.com/users/{myuser}/repos

我得到回复

{
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3"
}

.文档是这样说的:为经过身份验证的用户创建一个新的存储库。发布/用户/存储库。https://developer.github.com/v3/repos/#create。我是github-api的新手,感谢你的帮助。

请参阅此 curl 教程,了解您的 GitHub API 调用

发布

使用--request(-X(标志和--data(-d(来POST数据

curl --user "caspyin" --request POST --data '{"description":"Created via API","public":"true","files":{"file1.txt":{"content":"Demo"}}' https://api.github.com/gists
curl --user "caspyin" -X POST --data '{"description":"Created via API","public":"true","files":{"file1.txt":{"content":"Demo"}}' https://api.github.com/gists

当然 --data 意味着 POST,所以你不必也指定 --request 标志

curl --user "caspyin" --data '{"description":"Created via API","public":"true","files":{"file1.txt":{"content":"Demo"}}' https://api.github.com/gists

好的,我知道了。我只是使用了错误的网址。这就是我所做的

curl --user "{user}:{password}" -X POST -d '{"name":"api-test","description":"made with github api","private":"true","homepage":"https://github.com"}' \ https://api.github.com/user/repos // <- IMPORTANT PART

最新更新