我正在尝试通过 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/