I am trying to implement a PUT edit to a file in my repository, and am running into issues... Here's what I have so far..
// GET content from github file
$.get('https://api.github.com/repos/redemption23/trackerApp/contents/file.txt', function(data){
var content = atob(data.content);
$('#box').append(content);
});
This is pulling the content in just fine... however trying to PUT an edit back into the file is failing..
// PUT edit to github file
$.ajax({
method: "PUT",
url: "https://api.github.com/repos/redemption23/trackerApp/contents/file.txt"
data: {
"message": "my commit message",
"committer": {
"name": "Matt",
"email": //omitted for stack overflow
},
"content": text,
"sha": //omitted for stack overflow
}
})
.done(function( msg ) {
console.log( "Data Saved: " + msg );
});
console.log(text);
I am able to pull the content from the file and append it to the body of my web app, but trying to send the edit via the api isn't working.. returning with this error..
jquery.min.js:4 PUT https://api.github.com/repos/redemption23/trackerApp/contents/file.txt
Any ideas??