Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,560
Community Members
 
Community Events
165
Community Groups

Bitbucket Cloud API does not work with cURL or wget

I'm trying to download an artifact I have uploaded to Bitbucket Downloads through cURL or wget. The issue seems to be that the cURL and wget don't receive an answer from the Bitbucket API.

How to reproduce:

- Have a file stored in https://bitbucket.org/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/

- Have an App password

- Use cURL/wget and the API to download the file.

- No output returns.

 

I have tried different variations, for example with a different Agent-Header:


curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -u ${USER} https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/${file}

 

But does not work.

I also have tried to follow the Step3b from the Deploy build artifacts to Bitbucket Downloads

but instead of POST trying with GET but the output is:

curl: (26) Failed to open/read local data from file/application

 

I'm not sure if the issue is from my side or any kind of bug or problem with the Bitbucket Cloud API.

1 answer

1 accepted

0 votes
Answer accepted

Fixed this.

The problem is related to the redirects. cURL was not following the redirects.

The -L flag makes cURL follow to the last redirect and downloads the file.

Example:

curl -L --compressed -X GET -u ${USER} https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/${file} > ${file}.tgz

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,169 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you