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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,459,871
Community Members
 
Community Events
176
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

Atlassian Community Events