gpt4 book ai didi

json - Github API 创建提交

转载 作者:可可西里 更新时间:2023-11-01 16:11:37 24 4
gpt4 key购买 nike

我需要 Github API 方面的帮助,

我需要通过 api 提交新版本的文件,我试图通过向

发送发布请求来实现这一点
https://api.github.com/repos/:username/:repo:/git/commits/

有数据

{
"login": "username",
"token": "auth_token",
"parent_commit": "sha",
"message": "commit message.",
"content": {
"path": "full/path",
"mode": "edit",
"data": "new content"
}
}

但它失败了,结果是没有找到。

有谁知道在哪里发送这个请求以及这种格式是否正确?

(格式灵感来自 - http://swanson.github.com/blog/2011/07/23/digging-around-the-github-api-take-2.html )

谢谢!

最佳答案

请注意,自 2013 年 5 月以来,您有一个 CRUD API available :

其中包括 file update API

{
"message": "my commit message",
"committer": {
"name": "Scott Chacon",
"email": "schacon@gmail.com"
},
"content": "bXkgdXBkYXRlZCBmaWxlIGNvbnRlbnRz",
"sha": "329688480d39049927147c162b9d2deaf885005f"
}

(内容为更新后的文件内容,Base64编码)

关于json - Github API 创建提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11301989/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com