Querying all repos in project

Scott Harman November 8, 2023

Hi team - I'm trying to query all repos in a workspace, but I get an empty response for some reason:

api.bitbucket.org/2.0/repositories/[workspacename]

{
"values": [],
"pagelen": 10,
"size": 0,
"page": 1
}

When I query the workspace:

https://api.bitbucket.org/2.0/workspaces/[workspacename]

I get:

{
"type": "workspace",
"uuid": "{ba9c2c51-0e86-4b0d-b893-f69d8aa2e916}",
"name": "[workspacename]",
"slug": "[workspacename]",
"is_private": true,
"links": {
"avatar": {
"href": "https://bitbucket.org/workspaces/[workspacename]/avatar/?ts=1679930059"
},
"hooks": {
"href": "https://api.bitbucket.org/2.0/workspaces/[workspacename]/hooks"
},
"html": {
"href": "https://bitbucket.org/[workspacename]/"
},
"html_overview": {
"href": "https://bitbucket.org/[workspacename]/workspace/overview/"
},
"members": {
"href": "https://api.bitbucket.org/2.0/workspaces/[workspacename]/members"
},
"owners": {
"href": "https://api.bitbucket.org/2.0/workspaces/[workspacename]/members?q=permission%3D%22owner%22"
},
"projects": {
"href": "https://api.bitbucket.org/2.0/workspaces/[workspacename]/projects"
},
"repositories": {
"href": "https://api.bitbucket.org/2.0/repositories/[workspacename]"
},
"snippets": {
"href": "https://api.bitbucket.org/2.0/snippets/[workspacename]"
},
"self": {
"href": "https://api.bitbucket.org/2.0/workspaces/[workspacename]"
}
},
"created_on": "2018-12-02T00:29:19.834722+00:00"
}

Going through .../projects/ takes me back to the same point

As I'm logged in as an owner, surely I should be able to see all the repos that I have access to?

1 answer

1 accepted

2 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 9, 2023

Hey @Scott Harman !

thank you for reaching out to Community :) 

The List repositories in a workspace endpoint should indeed return all the repositories of a workspace to which the authenticated user has access.

I tested in one of my own workspaces authenticating using an App Password, and the list was returned successfully : 

curl --request GET -u USERNAME:APP_PASSWORD 'https://api.bitbucket.org/2.0/repositories/{WORKSPACE}'

In this case, could you confirm what kind of authentication you are using to make the request?

If you are also using app passwords, it should have at least repo:read scope. You can also try using an app password with all the scopes selected to verify if the issue is permission-related.

Thank you, @Scott Harman !

Patrik S

Scott Harman November 10, 2023

Thanks - it only appears to work with an app password, but not with standard credentials.

Suggest an answer

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

Atlassian Community Events