repositories Endpoint

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:

Field Description
scm The source control manager for the repository. This is either hg or git.
has_wiki A boolean indicating if the repository has a wiki.
description A string containing the repository's description.
links An array of related objects.
updated_on A 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_on An ISO-8601 date timestamp of this repository's creation date.
owner The owner's account.
size The size of the repository in bytes.
parent The parent repository this repository was forked off (only present on forks). This is a repository object itself.
has_issues A boolean indicating a repository has an issue tracker.
is_private A boolean indicating if a repository is private or public.
full_name The unique key into the repository. This key has the format: {owner}/{repo_slug}
name The display name of the repository.
language The main (programming) language of the repository source files.

GET a list of repositories for an account

Gets the list of repositories associated with an 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
owner Yes The account of the repo owner.
role
no To 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.
  • 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.

These calls will only return team repositories to which a user has explicit access assigned either directly to the repository or through a team's user group. 

It will not return public repositories with no user or group permissions.

GET https://api.bitbucket.org/2.0/repositories/{owner}
  Click here to expand...

GET a list of repositories for a team

Gets the list of repositories associated with a 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
Yes The teamname (also known as the team id) of the team which owns the repositories.
role
no To 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:

Would return:

GET a list of all public repositories

Gets a list of all the public repositories on Bitbucket.  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. Only public repositories are returned.

GET  https://api.bitbucket.org/2.0/repositories
  Click here to expand...

Was this helpful?

Thanks for your feedback!

11 Archived comments

  1. User avatar

    Winston Lee

    GET a list of repositories for an account should be 

    not

     

     

    13 Nov 2013
    1. User avatar

      Alexandru G

      You are right. Ping Erik van Zijst [Atlassian]

      23 Jan 2014
  2. User avatar

    Constantine Kim

    I have few questions.

    1. How can I get the full list of the valid "language" value? I have to take it from the admin page?
    2. In the repository creation page, there is some rules to change repository name to "repo_slug". ex) jquery.ui  will be jquery.ui, but jquery/ui will be jquery-ui. How can I get to know about these rules?
    19 Nov 2013
    1. User avatar

      Erik van Zijst [Atlassian]

      1. How can I get the full list of the valid "language" value? I have to take it from the admin page?

      Yeah, currently there's no endpoint to list them all, unfortunately.

      Feel free to raise an issue at https://bitbucket.org/site/master for it though.

      How can I get to know about these rules?

      When specifying a name on repo creation, or when using the admin page to rename one, we "sluggify" the name that is provided. We don't have the exact rules documented, but it's essentially to make sure than any chars that are problematic for URLs (like spaces, question marks, etc), are taken out.

       

      19 Nov 2013
      1. User avatar

        Constantine Kim

        Thank you Erik van Zijst [Atlassian]. I'm gonna check it out.

        BTW, I cannot access https://bitbucket.org/site/master. It looks like an Atlassian's internal repository. 

         

        20 Nov 2013
        1. User avatar

          Erik van Zijst [Atlassian]

          It's the issue tracker for Bitbucket itself. Just click on issues: https://bitbucket.org/site/master/issues/new

          20 Nov 2013
  3. User avatar

    Dillon

    Any reason why the repositories in the collections above do not contain fork or star count? The old API used to and it was removed for some reason. Now it doesn't seem to be available anywhere.

    25 Dec 2013
  4. User avatar

    Anonymous

    What is the best way to get all the branches in a repository?

    18 Feb 2014
  5. User avatar

    loddit

    How to get a repos list whose I have a membership ? (like overview `all` tab list of web homepage.) 

    GET https://api.bitbucket.org/2.0/repositories/{myself} . this API return only repos my own, not a membership

    14 Aug 2015
    1. User avatar

      Erik van Zijst [Atlassian]

      GET https://api.bitbucket.org/2.0/repositories/{myself} . this API return only repos my own, not a membership

      Correct. Try https://api.bitbucket.org/2.0/repositories?role=member

      Note that adding owner to the path, you're effectively pre-filtering the set of repos to those you own.

      14 Aug 2015
      1. User avatar

        loddit

        I got it. Thanks a lot.

        14 Aug 2015
Powered by Confluence and Scroll Viewport