Reputation: 16673
As a follow up to In Bitbucket API, how can I get a list of ALL licensed users?, I know want to find ALL the repos owned by a user. However, the BB-server API doesn't seem to provide a filter for the repos endpoint? Moreover, seems like repos do not have a concept of an owner? IOW If I do
$ curl -s -u USER:PW -X GET https://bitbucket-server.domain.com/bitbucket/rest/api/1.0/repos?name=apr-util | jq --raw-output '.values[]'
I get
{
"links": {
"self": [
{
"href": "https://bitbucket-server.domain.com/bitbucket/projects/CAGLXY/repos/apr-util/browse"
}
],
"clone": [
{
"name": "ssh",
"href": "ssh://[email protected]:7999/caglxy/apr-util.git"
},
{
"name": "http",
"href": "https://[email protected]/bitbucket/scm/caglxy/apr-util.git"
}
]
},
"public": false,
"slug": "apr-util",
"id": 6289,
"name": "apr-util",
"scmId": "git",
"state": "AVAILABLE",
"statusMessage": "Available",
"forkable": true,
"project": {
"links": {
"self": [
{
"href": "https://bitbucket-server.domain.com/bitbucket/projects/CAGLXY"
}
]
},
"type": "NORMAL",
"public": false,
"description": "Project to house company's Ansible Git repos",
"name": "ansible-galaxy",
"id": 1883,
"key": "CAGLXY"
}
}
and I don't see an "owner" attribute. Is there no DIRECT way to get a list of repos owned by a user? If no, how would I go about compiling a list of repos owned by a user?
Upvotes: 1
Views: 1843
Reputation: 22321
The non-personal repositories don't have owners but you can list the personal repositories with the following command:
curl -s --user USER:PASS --request GET https://BITBUCKET-SERVER/rest/api/1.0/projects/~USER/repos | jq --raw-output '.values[].slug'
Upvotes: 2