The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Deepak Patankar
January 6, 2022

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 7, 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

TAGS
AUG Leaders

Atlassian Community Events