repositories Endpoint

robotsnoindex
robotsnoindex

Overview

The repositories endpoint has a number of resources you can use to manage repository resources. For all repository resources, you supply a  repo_slug that identifies the specific repository.  For example, the repo_slug for the repository  https://bitbucket.org/tortoisehg/ thg  is  thg .  The following resources are available on repositories:

The repositories endpoint allow you to control aspects of a repository.  An individual respository structure has the following fields:

FieldDescription
scmThe source control manager for the repository. This is either hg or git.
has_wikiA boolean indicating if the repository has a wiki.
descriptionA string containing the repository's description.
linksAn array of related objects.
updated_onA date timestamp of the last update to this repository.
fork_policy

Control the rules for forking this repository. Available values are:

  • allow_forks: unrestricted forking
  • no_public_forks: restrict forking to private forks (forks cannot be made public later)
  • no_forks: deny all forking
created_onAn ISO-8601 date timestamp of this repository's creation date.
ownerThe owner's account.
sizeThe size of the repository in bytes.
parentThe parent repository this repository was forked off (only present on forks). This is a repository object itself.
has_issuesA boolean indicating a repository has an issue tracker.
is_privateA boolean indicating if a repository is private or public.
full_nameThe unique key into the repository. This key has the format: {owner}/{repo_slug}
nameThe display name of the repository.
languageThe main (programming) language of the repository source files.

GET a list of repositories for an account

Gets the list of repositories owned by the specified account. If the caller is properly authenticated and authorized, this method returns a collection containing public and private repositories. Otherwise, this method returns a collection of the public repositories. This produces a paginated response.

Parameter
Required?
Description
ownerYesThe account of the repo owner.
role
noTo limit the set of returned repositories, apply the role=[owner|admin|contributor|member] parameter where the roles are:
  • owner: returns all repositories owned by the current user (note that using this on an account other than your own will always result in an empty list).
  • admin: returns repositories to which the user has explicit administrator access.
  • contributor: returns repositories to which the user has explicit write access.
  • member: returns repositories to which the user has explicit read access.
GET https://api.bitbucket.org/2.0/repositories/{owner}
Click here to expand...
{
    "page": 1,
    "pagelen": 10,
    "size": 1,
    "values": [
        {
            "created_on": "2014-08-13T19:05:22.148829+00:00",
            "description": "This repo ",
            "fork_policy": "allow_forks",
            "full_name": "dans9190/new-repository",
            "has_issues": false,
            "has_wiki": false,
            "is_private": false,
            "language": "",
            "links": {
                "avatar": {
                    "href": "https://d3oaxc4q5k2d6q.cloudfront.net/m/57a3af3749c5/img/language-avatars/default_16.png"
                },
                "clone": [
                    {
                        "href": "https://bitbucket.org/dans9190/new-repository.git",
                        "name": "https"
                    },
                    {
                        "href": "ssh://git@bitbucket.org/dans9190/new-repository.git",
                        "name": "ssh"
                    }
                ],
                "commits": {
                    "href": "https://api.bitbucket.org/2.0/repositories/dans9190/new-repository/commits"
                },
                "forks": {
                    "href": "https://api.bitbucket.org/2.0/repositories/dans9190/new-repository/forks"
                },
                "html": {
                    "href": "https://bitbucket.org/dans9190/new-repository"
                },
                "pullrequests": {
                    "href": "https://api.bitbucket.org/2.0/repositories/dans9190/new-repository/pullrequests"
                },
                "self": {
                    "href": "https://api.bitbucket.org/2.0/repositories/dans9190/new-repository"
                },
                "watchers": {
                    "href": "https://api.bitbucket.org/2.0/repositories/dans9190/new-repository/watchers"
                }
            },
            "name": "New repository",
            "owner": {
                "display_name": "Daniel  Stevens",
                "links": {
                    "avatar": {
                        "href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2014/Jan/29/dans9190-avatar-2647033047-1_avatar.png"
                    },
                    "html": {
                        "href": "https://bitbucket.org/dans9190"
                    },
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/users/dans9190"
                    }
                },
                "username": "dans9190",
                "uuid": "{1cd06601-cd0e-4fce-be03-e9ac226978b7}"
            },
            "scm": "git",
            "size": 33348,
            "updated_on": "2014-08-13T19:05:22.168083+00:00",
            "uuid": "{9bdd6b69-3dc4-406b-a8dd-ff5119aefc61}"
        }
    ]
}

GET a list of repositories for a team

Gets the list of repositories owned by the specified team. If the caller is properly authenticated and authorized, this method returns a collection containing public and private repositories. Otherwise, this method returns a collection of the public repositories. This produces a paginated response.

Parameter
Required?
Description
teamname
YesThe teamname (also known as the team id) of the team which owns the repositories.
role
noTo limit the set of returned repositories, apply the role=[owner|admin|contributor|member] parameter where the roles are:
  • admin: returns repositories to which the user has explicit administrator access.
  • contributor: returns repositories to which the user has explicit write access.
  • member: returns repositories to which the user has explicit read access.
GET https://api.bitbucket.org/2.0/repositories/{teamname}
Click here to expand...

To GET all the public repositories for Teams In Space:

curl https://api.bitbucket.org/2.0/repositories/teamsinspace

Would return:

 {
    "pagelen": 10,
    "values": [{
        "scm": "git",
        "has_wiki": true,
        "description": "",
        "links": {
            "watchers": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/watchers"
            },
            "commits": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/commits"
            },
            "self": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket"
            },
            "html": {
                "href": "https://bitbucket.org/teamsinspace/design-bucket"
            },
            "avatar": {
                "href": "https://d3oaxc4q5k2d6q.cloudfront.net/m/fc0cb8a00976/img/language-avatars/default_16.png"
            },
            "forks": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/forks"
            },
            "clone": [{
                "href": "https://bitbucket.org/teamsinspace/design-bucket.git",
                "name": "https"
            }, {
                "href": "ssh://git@bitbucket.org/teamsinspace/design-bucket.git",
                "name": "ssh"
            }],
            "pullrequests": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/pullrequests"
            }
        },
        "fork_policy": "allow_forks",
        "name": "design-bucket",
        "language": "",
        "created_on": "2014-07-25T01:10:59.815371+00:00",
        "full_name": "teamsinspace/design-bucket",
        "has_issues": false,
        "owner": {
            "username": "teamsinspace",
            "display_name": "Teams In Space",
            "uuid": "{61fc5cf6-d054-47d2-b4a9-061ccf858379}",
            "links": {
                "self": {
                    "href": "https://api.bitbucket.org/2.0/teams/teamsinspace"
                },
                "html": {
                    "href": "https://bitbucket.org/teamsinspace"
                },
                "avatar": {
                    "href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2014/Sep/24/teamsinspace-avatar-3731530358-7_avatar.png"
                }
            }
        },
        "updated_on": "2014-10-29T21:28:23.189145+00:00",
        "size": 1346635,
        "is_private": false,
        "uuid": "{23ff7c6f-6f21-4d0c-ae7e-35069e097686}"
    }, {
        "scm": "git",
        "has_wiki": false,
        "description": "",
        "links": {
            "watchers": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/watchers"
            },
            "commits": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/commits"
            },
            "self": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org"
            },
            "html": {
                "href": "https://bitbucket.org/teamsinspace/teamsinspace.bitbucket.org"
            },
            "avatar": {
                "href": "https://d3oaxc4q5k2d6q.cloudfront.net/m/fc0cb8a00976/img/language-avatars/default_16.png"
            },
            "forks": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/forks"
            },
            "clone": [{
                "href": "https://bitbucket.org/teamsinspace/teamsinspace.bitbucket.org.git",
                "name": "https"
            }, {
                "href": "ssh://git@bitbucket.org/teamsinspace/teamsinspace.bitbucket.org.git",
                "name": "ssh"
            }],
            "pullrequests": {
                "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/pullrequests"
            }
        },
        "fork_policy": "allow_forks",
        "name": "teamsinspace.bitbucket.org",
        "language": "",
        "created_on": "2014-09-23T16:40:12.835612+00:00",
        "full_name": "teamsinspace/teamsinspace.bitbucket.org",
        "has_issues": false,
        "owner": {
            "username": "teamsinspace",
            "display_name": "Teams In Space",
            "uuid": "{61fc5cf6-d054-47d2-b4a9-061ccf858379}",
            "links": {
                "self": {
                    "href": "https://api.bitbucket.org/2.0/teams/teamsinspace"
                },
                "html": {
                    "href": "https://bitbucket.org/teamsinspace"
                },
                "avatar": {
                    "href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2014/Sep/24/teamsinspace-avatar-3731530358-7_avatar.png"
                }
            }
        },
        "updated_on": "2014-09-25T17:36:42.979044+00:00",
        "size": 76152,
        "is_private": false,
        "uuid": "{a2925176-b539-4985-b4d6-44c59850b3bb}"
    }],
    "page": 1,
    "size": 2
}

 

GET a list of all repositories

Gets a list of all the repositories on Bitbucket Cloud.  This produces a paginated response. Pagination only goes forward (it's not possible to navigate to previous pages) and navigation is done by following the URL for the next page.

The returned repositories are ordered by creation date, oldest repositories first. Unless the role parameter is specified, only public repositories are returned.

Parameter
Required?
Description
rolenoTo limit the set of returned repositories, apply the role=[owner|admin|contributor|member] parameter where the roles are:
  • admin: returns repositories to which the user has explicit administrator access.
  • contributor: returns repositories to which the user has explicit write access.
  • member: returns repositories to which the user has explicit read access.
GET  https://api.bitbucket.org/2.0/repositories
Click here to expand...
{
    "pagelen": 10,
    "values": [{
        "scm": "hg",
        "has_wiki": true,
        "description": "Mercurial (hg) extension to allow commenting on commit messages.  Mainly written for practice reading & working with mercurial internals.\r\n",
        "links": {
            "watchers": {
                "href": "https://api.bitbucket.org/2.0/repositories/phlogistonjohn/tweakmsg/watchers"
            },
            "commits": {
                "href": "https://api.bitbucket.org/2.0/repositories/phlogistonjohn/tweakmsg/commits"
            },
            "self": {
                "href": "https://api.bitbucket.org/2.0/repositories/phlogistonjohn/tweakmsg"
            },
            "html": {
                "href": "https://bitbucket.org/phlogistonjohn/tweakmsg"
            },
            "avatar": {
                "href": "https://d3oaxc4q5k2d6q.cloudfront.net/m/83c512cdf761/img/language-avatars/default_16.png"
            },
            "forks": {
                "href": "https://api.bitbucket.org/2.0/repositories/phlogistonjohn/tweakmsg/forks"
            },
            "clone": [{
                "href": "https://bitbucket.org/phlogistonjohn/tweakmsg",
                "name": "https"
            }, {
                "href": "ssh://hg@bitbucket.org/phlogistonjohn/tweakmsg",
                "name": "ssh"
            }],
            "pullrequests": {
                "href": "https://api.bitbucket.org/2.0/repositories/phlogistonjohn/tweakmsg/pullrequests"
            }
        },
        "fork_policy": "allow_forks",
        "name": "tweakmsg",
        "language": "",
        "created_on": "2008-06-25T00:53:00.273366+00:00",
        "full_name": "phlogistonjohn/tweakmsg",
        "has_issues": true,
        "owner": {
            "username": "phlogistonjohn",
            "display_name": "John Mulligan",
            "uuid": "{c8614bfa-831a-49eb-866b-4bdd87c8c2c2}",
            "links": {
                "self": {
                    "href": "https://api.bitbucket.org/2.0/users/phlogistonjohn"
                },
                "html": {
                    "href": "https://bitbucket.org/phlogistonjohn"
                },
                "avatar": {
                    "href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2009/Nov/07/Screenshot1_avatar.png"
                }
            }
        },
        "updated_on": "2012-06-24T17:32:27.458855+00:00",
        "size": 7085,
        "is_private": false,
        "uuid": "{59299fb9-3695-4e0c-b8ca-836888b83315}"
    }, 
Last modified on Jun 24, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.