How to download a raw file from BitBucket repository using Token ? (BitBucket version is v4.3.2).

Sowmiya
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!
February 13, 2018

I could download the files but only as json using the below command:

curl -L -O -G -H "X-Auth-User:userName" -H "X-Auth-Token:userToken" http://xx.xxx.xxx.xxx:7990/rest/api/1.0/projects/DOC/repos/xxx/browse/Jenkinsfile -d at=refs/heads/jenkinsfile -d raw

 

X-Auth-Token provided in the above URL is obtained from Token authentication plugin .

But my aim is

1. To download raw file using above format (not in json format)

2. To have a service account and require a common token for it and download the raw file from a repo

Any help would be appreciated!

2 answers

1 vote
John Lawlor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2018

You could try:

 curl -X GET -H "Authorization: Bearer $PAC" https://xxxxxxx:7990/rest/api/latest/projects/DOC/repos/xxx/raw/Jenkinsfile

assuming the file you want is: Jenkinsfile and $PAC is your authorization token

0 votes
Sowmiya
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!
February 15, 2018

Thanks John.

 

I'm able to access it with PAC in BitBucket version 5.7. But in v4.3.2 PAC option is not available.

Tried using Token authentication x-token-auth but it downloads the file in json format.

I want to use this x-token-auth and download the raw file instead.

andykimpe December 14, 2022

yes raw not work please solve

 

wget --user=x-token-auth --password=access_token --auth-no-challenge https://bitbucket.org/andykimpe/euroiptv-epg-fr/raw/master/config/France/TF1/TF1.xml

 

--2022-12-14 15:30:30-- https://bitbucket.org/andykimpe/euroiptv-epg-fr/raw/master/config/France/TF1/TF1.xml
Resolving bitbucket.org (bitbucket.org)... 104.192.141.1, 2406:da00:ff00::22e9:9f55, 2406:da00:ff00::22c0:3470, ...
Connecting to bitbucket.org (bitbucket.org)|104.192.141.1|:443... connected.
HTTP request sent, awaiting response... 401 Unauthorized

Username/Password Authentication Failed.

 

wget --header 'Authorization: Bearer access_token' https://bitbucket.org/andykimpe/euroiptv-epg-fr/raw/master/config/France/TF1/TF1.xml

 

--2022-12-14 15:31:32-- https://bitbucket.org/andykimpe/euroiptv-epg-fr/raw/master/config/France/TF1/TF1.xml
Resolving bitbucket.org (bitbucket.org)... 104.192.141.1, 2406:da00:ff00::22c5:2ef4, 2406:da00:ff00::6b17:d1f5, ...
Connecting to bitbucket.org (bitbucket.org)|104.192.141.1|:443... connected.
HTTP request sent, awaiting response... 401 Unauthorized

 

this work

git clone https://x-token-auth:access_token@bitbucket.org/andykimpe/euroiptv-epg-fr.git

 

please solve this problem access_token on raw not work

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events