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

Bitbucket API - Get file with access token

Nitea
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 27, 2023

Hello,

 

I would like to get a ZIP-file for a tag from my private repository via access token.

I manage to get the zip-file via App-password, but I don't want to share an App-password where the App-password gives acccess to all my repositories.

 

I use this URL to get the ZIP-file: https://bitbucket.org/{username}/{repository}/get/{tagname}.zip

 

Any suggestions on how I can accomplish this with access token created in the current repository?

1 answer

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2023

Hi @Nitea and welcome to the community!

I'm afraid that we do not support downloading archives with a repository access token at the moment.

I went ahead and created a feature request in our issue tracker:

I would suggest adding your vote (by selecting the Vote for this issue link) and a comment there to further express your interest. You can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

In the meantime, until this gets implemented, a way to achieve what you want without exposing your app password would be to use a git clone command as follows

git clone --depth 1 --branch <branch_or_tag> https://x-token-auth@bitbucket.org/<workspace-id>/<repo-slug>.git

<branch_or_tag> can be either a branch or a tag name
--depth 1 will clone only one commit and it is an optional argument. If you only need the source code files, I assume there is no need to clone the whole history.

You can then navigate to the clone directory and delete the .git folder if you don't need a repo, but only the source code files.

Kind regards,
Theodora

Nitea
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 16, 2023

Hello!

 

Thank you!

 

I made a bridge between My APP and Bitbucket where i handle unique tokens and then the bridge make the call via Username and App password.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 17, 2023

You are very welcome @Nitea and thank you for sharing your solution here.

Please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, ace, atlassian community event, donation, girls who code, women in tech, malala fund, plan international, kudos, community badge, badge, atlassian badge, International Women’s month, International Women’s Day, women's month, women's day

10 for Change at Atlassian Community Events

Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!

Join an Atlassian Community Event!
AUG Leaders

Upcoming Bitbucket Events