It shows the ability to PUT or update a file in the repo. It also references a branch parameter, but how do specify that in the url or http query parameters ? I presume the update file goes in as a json data stream like what GET returns ?
Jenli,
Apologies for the unclear REST documentation. We are working on making it more user friendly. This resource accepts PUT multipart form data, containing the file in a form-field named âcontentâ. An example curl request to update âREADME.mdâ would be:
Thank you for the clarification. I was able to use the multipart content type to submit new files into the bitbucket repo. However, when I try to update an existing file, an error shows up:
curl -XPUT ⊠-F sourceCommitId=xxxxx âŠ
{âerrorsâ:[{
âcontextâ:null,
âmessageâ:ââdefinition/fooâ could not be created because it already exists. A previous commit ID must be provided when editing an existing file to prevent concurrent modifications.â,
âexceptionNameâ:âcom.atlassian.bitbucket.content.FileAlreadyExistsExceptionâ
}]}
I provided the commit ID from the latest commit on the branch for sourceCommitId.
Is the parameter âsourceCommitIdâ incorrect labeled ?
The documentation says that if the commit ID is null, then it is expecting to store a new file, which is like the behavior I am seeing, ie the REST agent canât find the commit ID from multiform content, and assigning it null, and then expects the file to be new.
Iâm also trying to PUT some files to my repository but something wrong in my cURL request , I couldnât find that. Please see the Raw file URL of the file I want to PUT
Iâm not sure whether Iâm using correct syntax , Please correct me if anything wrong.
Iâm confused with the documentations.And Iâm stuck on this.