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?
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
Thanks - it only appears to work with an app password, but not with standard credentials.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.