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.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.