Forums

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

How to download a repository for a commit using rest api 2.0 via jwt/access token

dev works February 22, 2023

I have an app, using which i am generating an access token/ jwt token i wanted to know thw API for which i can download repository by

1. Commit id

2. branch 

 

Please suggest

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 23, 2023

Hello @dev works ,

Welcome to the community!

You can use the below endpoint to download a repository .zip file at a specific commit or branch : 

https://bitbucket.org/<workspace slug>/<repo slug>/get/<commit hash or branch name>.zip

Following are two examples using curl and providing the authentication headers as a Bearer token:

  • For branch : 
curl --request GET \

  --url 'https://bitbucket.org/<workspace slug>/<repo slug>/get/master.zip' \

  --header 'Authorization: Bearer <access token>'
  • For commit hash : 
curl --request GET \

  --url 'https://bitbucket.org/<workspace slug>/<repo slug>/get/<commit hash>.zip' \

  --header 'Authorization: Bearer <access token>'

Hope that helps! Let me know if you have any other questions.

Thank you, @dev works !

Patrik S 

dev works February 23, 2023

This is working thank you 

dev works February 27, 2023

@Patrik S Does this API work with Repository token as well ? currently it is not working for me

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 28, 2023

Hello @dev works ,

Unfortunately, this API does not yet support using Repository Access tokens for authentication. I went ahead and created a feature request for it, which you can check in the link below:

I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind.

Currently, it's only possible to use the username and app password or OAuth access token as the credentials for authentication for that particular API endpoint.

Let me know in case you have any questions.

Thank you, @dev works !

Patrik S

Like Ivan Vulović likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events