Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

API to create a file doesn't returns the commitId ?

I am creating a new file in the bitbucket using the api given in the doc at


https://developer.atlassian.com/cloud/bitbucket/rest/api-group-source/#api-repositories-workspace-repo-slug-src-post


The API successfully created the file in bitbucket but it didn't return the commitId. Since the API is to "Create a commit by uploading a file", it should have returned the commitId ?

Also is there any other way I can retrieve this commitId ?

 

1 answer

0 votes
Caroline R Atlassian Team Jan 07, 2022

Hi, @Deepak Patankar

Thank you for reaching out to Atlassian Community!

You could use the verbose option to receive the commit ID, for example:

curl POST -u username:AppPassword 
--url https://api.bitbucket.org/2.0/repositories/{workspaceID}/{repository_name}/src
-F /repo/path/to/image.png=@image.png
--form 'message=my commit message' -v

It will give you the following information:

location: https://api.bitbucket.org/2.0/repositories/{workspaceID}/{repository_name}/commit/{commitID}

I hope this helps, but do let me know if you have any questions.

Kind regards,
Caroline

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

126 views 2 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you