api - 通过其 API 更新要点

标签 api github gist

我正在尝试通过 API 调用编辑现有的 Gist,遵循 API 文档,我正在执行这样的 curl 调用:
curl -X PATCH -d'{"description": "the description for this gist", "files": {"file1.txt": {"content": "updated file contents"}}}' https://api.github.com/gists/5790365
但它不断返回“未找到”错误。

我在这里错过了什么吗?

最佳答案

刚刚弄清楚为什么它不起作用。

看起来您无法编辑匿名 gist,为了使用它进行身份验证,您需要为您的帐户生成一个 token API 并指定您要在范围内与 gist 一起使用,如下所示:https://help.github.com/articles/creating-an-oauth-token-for-command-line-use

之后,您可以进行 API 调用,使用 token 传递 Authorization header ,一切都应该按预期工作。

关于api - 通过其 API 更新要点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17129465/

相关文章:

java - 如何使用java api以列表作为参数在elasticsearch上进行搜索

git - 设置 IntelliJ IDEA 和 Git

git - 在 github 上查找提交的分支

git - 从 Github 中提取所有 Gist ?

Github API 列出已删除的要点

c# - 指示服务器请求失败的最佳实践方法?

node.js - 尝试使用访问 token 访问 Spotify Web api 时收到 401

api - 创建指向 LinkedIn 公司更新的直接 url

reactjs - Github 中This branch has not been deployed 是什么意思?

Github - 如何通过 API 搜索要点?