I'm trying to edit an existing Gist through an API call, following the API docs, I'm doing a curl call like this:
curl -X PATCH -d'{"description": "the description for this gist", "files": {"file1.txt": {"content": "updated file contents"}}}' https://api.github.com/gists/5790365
But it keeps returning a 'Not Found' error.
Am I missing something here?
You can add a new gist, modify, and delete files and code entirely from within your browser.
The Gists API enables the authorized user to list, create, update and delete the public gists on GitHub. Gists. List gists for the authenticated user. Create a gist. List public gists.
Most of you probably know and use Github Gists for sharing Code snippets. But did you know that Gists also support Markdown? Using Markdown makes it easy to create much richer code shareable code and even allows for an easy way to create self-contained Web content.
Just figured out why it wasn't working.
It looks like you can't edit an anonymous gist, and in order to use it authenticated, you need to generate a token API for your account and specify that you want to use with gist in the scope, as shown here: https://help.github.com/articles/creating-an-oauth-token-for-command-line-use
After that you can make API calls passing the Authorization header with the token and everything should work as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With