The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Unable to list all my respositories using Bitbucket clould API

Sudharsan S
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!
January 26, 2023

I am using my Bitbucket APP password to list all my repositories.

However, I am unable to perform through REST API

 

import requests
import json
url = "https://api.bitbucket.org/2.0/repositories/MY-ORG?role=member"

headers = {
"Accept": "application/json",
"Authorization": "MY-APP-PASSWORD"
}

response = requests.request(
"GET",
url,
headers=headers
)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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

Hi @Sudharsan S and welcome to the community!

An app password cannot be used by itself for authentication, like an OAuth access token. It needs to be used in combination with your Bitbucket account's username. You can find your username here https://bitbucket.org/account/settings/ after you log in to your account.

With curl, for example, you can use it as follows:

curl -u BitbucketUsername:AppPassword -X GET -H "Content-Type: application/json" https://api.bitbucket.org/2.0/repositories/workspace-id?role=member

Or with a basic auth header, where b64string is BitbucketUsername:AppPassword encoded in base64

curl -X GET -H "Authorization: Basic b64string" -H "Content-Type: application/json" https://api.bitbucket.org/2.0/repositories/workspace-id?role=member

Kind regards,
Theodora

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events