I checked this API https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/srcwhenever i upload the file, it will get created or updated in the main branch only, despite of specifying the branch nameBelow is the example:https://api.bitbucket.org/2.0/repositories/test-node-workspace/node-rest-server/src?branch=devBut its not working
Hello @rahul kallur and welcome to the community.
By default, if not otherwise specified, the commit will be created on the top of the main branch of the repository. If you would like to commit to a different branch, you will need to provide a form-data field with the key branch containing the name of the branch to which you want to commit.
Following is an example of using the API to commit a file to a branch named development:
curl -X POST -u username:app_password https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/src \ --data-urlencode "/folder/inside/repo.txt=Content of the file" \ --data-urlencode "message=My commit message " \ --data-urlencode "branch=development"
Could you try with a request similar to the above and let us know how it goes?
Should you have any questions, feel free to ask.
Thank you, @rahul kallur !
Patrik S
Thank you, @Patrik S It's working
Awesome! Happy to hear it's working
If you ever need help in the future, feel free to reach out to Community!
It looks like you're new here. Sign in or register to get started.