I am trying to update a gist through the GitHub API. I first ran this command in my terminal:
curl -H "Authorization: token xxxxxxxxxx" -X PATCH -d '{"files": {"InputFile.txt": {"content": "LMAO YEET"}}}' https://api.github.com/gists/xxxxxxxxxx
This command ran with no errors, and my Gist was updated.
However, I ran into a problem when I tried to execute this code in java:
Process proc = Runtime.getRuntime().exec("curl -H \"Authorization: token xxxxxxxxxx\" -X PATCH -d '{\"files\": {\"InputFile.txt\": {\"content\": \"LMAO YEET\"}}}' https://api.github.com/gists/xxxxxxxxxx");
Running this code gave me a 404 not found error. It would be great if someone could explain why this is happening and if there is a workaround for it.
Thanks in advance!
PS: I know there is a Java API library, but I want to stick to Java's native libraries for now
PPS: Some information have been changed to "xxxxxxxxxx" for obvious reasons.