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

I want to download my private repository from bitbucket using api calls from my flutter app.

Devansh Mathur December 9, 2022

I want to download my private repository from bitbucket using API calls from my flutter code(DART), how can I download?

1 answer

1 accepted

1 vote
Answer accepted
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 12, 2022

Hi @Devansh Mathur,

Welcome to the community.

Unfortunately, we don't have an official API endpoint for you to use to download a repository.

Right now, we have the following workarounds:

To download or get a specific file from your repository, you can use this API endpoint. - Get file or directory contents

To download a repository as a compressed folder, you can use the endpoint below which is also used in your repository Downloads section.
Please do note that it only downloads specific revisions from your repository (e.g. the latest commit or tags or branches)

curl -u bbusername:app_password https://bitbucket.org/{workspace}{repo}/get/master.tar.gz -o master.tar.gz

Hope it helps and do let me know if you have further questions.

Regards,
Mark C

Devansh Mathur December 12, 2022

Hello @Mark C 

Thank you for the answer.

I already know about this API to download files I was only searching for an API to download the repository. 

And I got the API for which I was looking.

Regards,

Devansh

Devansh Mathur December 14, 2022

Hello @Mark C 

Can you provide the documentation for this curl.

curl -u bbusername:app_password https://bitbucket.org/{workspace}{repo}/get/master.tar.gz -o master.tar.gz

I am not able to hit API through my flutter code. 

Devansh Mathur December 15, 2022

Hello @Mark C 

And please do let me know the response type or the encoding technique used in the response of this API.

I am not able to process the data received from this API using my flutter code.

 

I have used both Dio and HTTP packages in flutter for API call and an exception is received that is 

"XMLHttpRequest error"

I have tried this link https://stackoverflow.com/questions/65630743/how-to-solve-flutter-web-api-cors-error-only-with-dart-code/66879350#66879350

it says to disable the security.

and after disabling the security the API gives me the response.

so is there any way to hit the API without disabling the security?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events