Github API 错误 - { "message": "Not Found", "documentation_url": "https://developer.github.com/v3" } 在 cURL 终端中制作 repo

Github API error - { "message": "Not Found", "documentation_url": "https://developer.github.com/v3" } making repo in cURL terminal

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"
}

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

为您的 GitHub API 通话查看此 curl tutorial

POST

Use the --request (-X) flag along with --data (-d) to POST data

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

Of course --data implies POST so you don't have to also specify the --request flag

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

好的,我知道了。我只是用错了url。这就是我所做的

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