Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

REST API for downloading(InputStream) a Repository

Vipin Kumar
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!
July 22, 2023

Hi team,

Is there a REST API to get the InputStream of a Repository?

Seems like it was available in 1.0 APIs
https://docs.atlassian.com/bitbucket-server/rest/7.14.0/bitbucket-rest.html#idp199

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 25, 2023

Hi @Vipin Kumar and welcome to the community!

Are you looking to get an archive of a repository hosted in Bitbucket Cloud or Bitbucket Server? Your question has the tag 'bitbucket-cloud', but the API endpoint you posted is of Bitbucket Server.

Bitbucket Cloud has a different API (its documentation is here: https://developer.atlassian.com/cloud/bitbucket/rest/intro/).

There is no API endpoint to download an archive of a Bitbucket Cloud repo, but you can use a curl command like the following to get an archive of the source code in e.g. the master branch:

curl -u BitbucketUsername:AppPassword https://bitbucket.org/workspace-id/repo/get/master.tar.gz -o master.tar.gz

where
BitbucketUsername replace with the username of a Bitbucket Cloud account with access to the repo
AppPassword replace with an app password for this account that has at least Repositories: Read permissions
workspace-id replace with the id of the workspace where the repo belongs
repo replace with your repo's slug
master replace with the name of the branch you want to get the source code of

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events