Hello Atlassian Team,
I am currently using the Bitbucket Cloud REST API to delete a file from a repository by creating a commit. The API, I am using is the /src endpoint, as documented.
API being used:
curl -X POST \<br> 'https://api.bitbucket.org/2.0/repositories/test_org18/bdtestrepo/src' \<br> -H 'Authorization: Bearer <ACCESS_TOKEN>' \<br> -F 'branch=test' \<br> -F 'message=Delete test.txt' \<br> -F 'testing.txt='
This API successfully creates a commit and clears the content of the file. However, the file name still appears in the repository tree (as a zero-byte / empty file), instead of being removed entirely from the branch.
I would like to clarify the following:
- Is there any flag, parameter, or alternate API that allows deleting the file entirely (so that it no longer appears in the branch)?
- Is the
/src endpoint the only supported API for file deletion with a commit in Bitbucket Cloud? - Or is complete file removal only possible through the Bitbucket UI ?
- Is there any alternative API to delete the file?
I have reviewed the Bitbucket REST API documentation but could not find any alternative API or option to delete the file instead of erasing of content.
Any clarification on this behavior would be very helpful.
Thank you.