通过其API更新要点

Thi*_*tes 4 api gist github

我正在尝试通过API调用编辑现有的Gist,遵循API文档,我正在进行如下卷曲调用:

curl -X PATCH -d'{"description": "the description for this gist", "files": {"file1.txt": {"content": "updated file contents"}}}' https://api.github.com/gists/5790365

但它不断返回"未找到"错误.

我在这里错过了什么吗?

Thi*_*tes 8

只是弄清楚它为什么不起作用.

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

之后,您可以通过带有令牌的Authorization标头进行API调用,一切都应该按预期工作.