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

Downloading files from Bitbucket Downloads from Bitbucket Pipeline

Akshay Gollahalli
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!
April 8, 2024

How would I download the files from Bitbucket Downloads from Bitbucket pipeline?

I tried doing:

curl -L -O -u ${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD} "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/opencv-4.9.0-linux-android.tar.gz"

 
I am using the app ID and all I download it an empty file and the headers show 401.

I tried the repository level access token with (I am the admin of this repository):

curl --request GET \
--url "https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/downloads" \
--header "Authorization: Bearer ${token}"

And I get this error:

{"type": "error", "error": {"message": "You may not have access to this repository or it no longer exists in this workspace. If you think this repository exists and you have access, make sure you are authenticated."}}

Not sure what to do here.

 

1 answer

2 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 9, 2024

Hi Akshay,

Please try this cURL command - I've just tested this on my end and it worked without issues:

curl -L -u {Username}:{AppPassword} https://api.bitbucket.org/2.0/repositories/{WorkspaceID}/{RepoSlug}/downloads/{file.extension} --output {file.extension}

NOTE: Replace the placeholder values in curly braces {} with actual values (remove the braces in your command)

If you have configured the AppPassword with READ permissions, you should be able to perform the download.

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events