We are trying to find a way to download a single file from a Bitbucket project using the REST API at a specific commit. Currently, we have the ability to download a file at a specific branch:
Note that the end of the URL, when decoded, contains the query parameter at=refs/heads/master
, which refers to the master
branch. This also works for specific tags:
Here the query parameter at=refs/tags/testtag1
refers to the tag (commit) testtag1
.
But because of the nature of our implementation, we would like to refer directly to a commit SHA-1 hash via the Bitbucket REST API. Is this possible?
Obviously, one ugly workaround would be to just add a tag to every commit. But this could bloat the repository and it also feels like an unnecessary hack.