You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Curl:
curl --location --request PUT 'https://xyz-on-prem.mycom-beta.com/rest/api/latest/projects/IS/repos/new-repo/browse/newFile.txt' \
--header 'Authorization: Basic YWXXXXXXXXXXXXXXXXXXX==' \
--header 'Cookie: BITBUCKETSESSIONID=FXXXXXXXXXXXXXX' \
--form 'branch="main"' \
--form 'content="new file content"' \
--form 'message="Added new file"'
{
"errors": [
{
"context": null,
"message": "'/bin/git cat-file -t cbb0fc3bdedeeda8f8d9eaaaa8fc7644f93ec8ae:newFile.js' exited with code 128 saying: fatal: path 'newFile.js' does not exist in 'cbb0fc3bdedeeda8f8d9eaaaa8fc7644f93ec8ae'",
"exceptionName": "com.atlassian.bitbucket.scm.CommandFailedException"
}
]
}
When I am sending sourceCommitId as null in form body, I am getting the following error:
I want to create a new file, so that's obvious that newFile.js won't exist.
{
"errors": [
{
"context": null,
"message": "newFile.js could not be edited because the file has been deleted on the null branch.",
"exceptionName": "com.atlassian.bitbucket.content.NoSuchPathException"
}
]
}
One more issue I am facing is that, I am not able to use Access Token to authorize the request. When I am using Access token, I am getting this error while for other APIs, it is working fine.
{
"errors": [
{
"context": null,
"message": "When performing an edit, the author must have an e-mail address.",
"exceptionName": "com.atlassian.bitbucket.validation.ArgumentValidationException"
}
]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.