Missed Team ’24? Catch up on announcements here.

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

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!
April 4, 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.
April 5, 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!
April 6, 2023

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