Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Ground Controller Lvl 1
Message 1 of 2

"Update a file" API

I want to use update-a-file API to update a file from a Pull Request of my own repo. I have used a effective token,and I can edit the head branch of this PR witch forked from my repo,  but I still got an "Not Found". 

 

PUT /repos/:owner(pull.head.repo.name)/:repo(pull.head.repo.owner.login)/contents/:path(pull.files[0].filename)

 

Authorization: token personal-access-token
{
  "message": "my commit message",
  "content": "bXkgdXBkYXRlZCBmaWxlIGNvbnRlbnRz",
  "sha": "329688480d39049927147c162b9d2deaf885005f"(pull.files[0].sha)
}

 

sure the "maintainer_can_modify" is true; The repository is a public repository and I am the maintainer;and I have write access to the head,because I try to edit it on the web,it work.

 

1 Reply
Community Manager
Message 2 of 2

Re: "Update a file" API

If the second code block in your post is the body that you're submitting, it appears that you left out the branch name? If you're attempting to update a PR, I assume that the file that you're wanting to update isn't on the `master` branch?

 

If I'm incorrect, can you supply a minimal set of steps to reproduce the problem in a public repository so that we can take a closer look?