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,556,454
Community Members
 
Community Events
184
Community Groups

Rest API does not return file from downloads folder

Janne Jussila
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!
Apr 04, 2023

When running below request nothing is returned

curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/downloads/{filename}' \ --header 'Authorization: Bearer <access_token>'

 

Access rights should be right since running

curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/downloads' \ --header 'Authorization: Bearer <access_token>'

returns JSON describing contents of downloads folder including the file I'm trying to fetch.

Also running request to 

curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/src/master/README.md'  \ --header 'Authorization: Bearer <access_token>'

returns repo's README.md as expected. 

Any idea what's wrong on downloads folder GET request?

 

1 answer

1 accepted

0 votes
Answer accepted
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 05, 2023

Hi @Janne Jussila,

Welcome to the community.

Would it be possible for you to try to use the CURL command below instead?

curl -s -L --request GET --header 'Authorization: Bearer <access_token>' https://api.bitbucket.org/2.0/repositories/workspace_id/repo_name/downloads/filename.txt --output filename.txt

Let me know how it goes.

Regards,
Mark C

Janne Jussila
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!
Apr 06, 2023 • edited

Hi Mark,

I have tried with --output test.txt and also w/ -O. After these I do have file, but it's empty. 

I can see from logs that no data is actually received.

 

OOPS.....

didn't notice that your proposed curl had -s -L at start...

now it works. Thank a lot,

-janne

Suggest an answer

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

Atlassian Community Events