问题描述
我正在尝试使用Github v3 API - 我已经实现了所需的OAuth流程,并且运行良好。
现在我正在尝试一些Repos API端点(http://developer.github.com/v3/repos/)。
到目前为止,我可以使用GET / user / repos
获取我的回购清单。但是,当我尝试使用POST / user / repos创建回购时,得到一个404.
任何想法我可能做错了什么?
Joubert
你能告诉我们你做了什么HTTP请求吗?听起来好像你正在使用错误的路径,可能。但为了给出一个可靠的答案,而不是一个疯狂的猜测,我们需要看到你的请求,包括你如何发送你的令牌,只是用'xxx'或其他东西来掩盖。
我会在这段时间向您展示一个示例请求,它正在工作:
curl -XPOST -H'授权:令牌S3CR3T'https ://api.github.com/user/repos -d'{name:my-new-repo,description:my new repo description}'
您当然需要替换OAuth令牌: S3CR3T
I’m trying to use the Github v3 API - I already implemented the required OAuth flow and it works well.
Now I’m trying some of the Repos API endpoints (http://developer.github.com/v3/repos/).
So far, I’m able to get a List of my repos using: GET /user/reposHowever, when I try to create a repo using POST /user/repos, I get a 404.
Any thoughts what I might be doing wrong?
Joubert
Can you please tell us how exactly you did the HTTP request? The 404 sounds like you were using a wrong path, probably. But to give a reliable answer instead a wild guess, we need to see your request, including how you are sending your token, just mask it with 'xxx' or something.
I'll show you in the meantime an example request, that is working:
curl -XPOST -H 'Authorization: token S3CR3T' https://api.github.com/user/repos -d '{"name":"my-new-repo","description":"my new repo description"}'
You would need to replace the OAuth token of course: S3CR3T
这篇关于Github v3 API - 创建一个REPO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!