Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,465,232
Community Members
 
Community Events
176
Community Groups

Getting 500 on using Edit File BitBucket Data Center API

Edited

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"'
Hi, I am getting 500 on using BB Data Center API when I am trying to create a new file with commit using Edit File API.
I am getting the following error:
{

"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"

}

]

}

1 answer

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"

}

]

}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Atlassian Community Events