repository Resource 1.0

See repository Resource in the 2.0 API instead.

Overview

For the repository resource, you supply a  repo_slug that identifies the specific repository.  For example, the repo_slug for this repository  https://bitbucket.org/tortoisehg/thg   is thg.  You can use this resource to create a new repository or edit a specific one. There are several URLs that allow you to query for branch resources. Unauthenticated calls for this resource only return values for public repositories.

To see private repositories, you must have at least read permissions on the repository.

POST a new repository DEPRECATED

Creates a new repository under the account of the currently authenticated user.   The account automatically becomes the owner.  This method supports the following parameters:

Parameter Required? Description
name Yes The name of the repository
description No A description of the repository.
scm No A value of git or hg. The default is git if you leave this parameter unspecified.
language No The language used for source code in the repository. 
is_private No Boolean specifying if the repository is private (true) or public (false).  The default is false.
https://bitbucket.org/api/1.0/repositories  --data "name=mynewrepo"
  Click to view the data returned on success...

POST a new fork

Forks a new repository under the account of the currently authenticated user.   The account automatically becomes the owner.  This method supports the following parameters:

Parameter Required? Description
name Yes The name of the repository
description No A description of the repository.
scm Ignored You can supply this value but the system ignores it.
language No The language used for source code in the repository. 
is_private No Boolean specifying if the repository is private (true) or public (false).  The default is false.
https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/fork  --data "name=mynewrepo"
  Click to view the data returned on success...

PUT a repository update

Updates an existing repository.   The caller must authenticate as a user with administrative privileges to the account.  This method supports the following parameters:

Parameter Required? Description
accountname Yes The accountname of the repo owner.
repo_slug Yes The repository slug.
name No The user-visible name of the repository.
description No A description of the repository.
language No The language used for source code in the repository. 
is_private No Boolean specifying if the repository is private (true) or public (false).  The default is true.
landing_page No The default page to display when users navigate to your repository's URL.
website No A website related to your repository. For example, this might be a company website.
main_branch No The main branch for your repository.
analytics_key No A Google Analytics key for tracking. You obtain this from Google.
akismet_key No An Akismet key for reducing spam in your issue tracker.
https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug} --data "description=long description"
  Click here to expand...

DELETE an existing repository DEPRECATED

Deletes a repository.  The caller must authenticate as the repository owner. This method supports the following parameters:

Parameter Required? Description
accountname Yes The repository owner.
repo_slug Yes A repository belonging to the account.
https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}

Returns HTTP/1.1 204 NO CONTENT when successful.

GET list of branches

Gets a list of branches associated with a repository. This method supports the following parameters:

Parameter Required? Description
accountname Yes The team or individual account.
repo_slug Yes A repository belonging to the account.
https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/branches
  Click to view the data returned on success...

GET the repository's main branch

Gets the main-branch associated with the repository. You set the main branch from a repository's Repository details page:

This method supports the following parameters:

Parameter Required? Description
accountname Yes The team or individual account.
repo_slug Yes A repository belonging to the account.
https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/main-branch
  Click to view the data returned on success...

If there is a main branch set, the call returns the branch name.

{
    "name": "master"
}

If there is no main branch set, this call returns the following

No main branch set.

GET list of branches-tags

Gets a list of branches and associated tags for a repository

This method supports the following parameters:

Parameter Required? Description
accountname Yes The team or individual account.
repo_slug Yes A repository belonging to the account.
https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/branches-tags
  Click to view the data returned on success...

GET the repository manifest

Gets a repository's manifest for a revision. This method supports the following parameters:

Parameter Required? Description
accountname Yes The team or individual account.
repo_slug Yes A repository belonging to the account.
revision Yes A revision to get such as default or master.
https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/{revision}
  Click to view the data returned on success...

GET a list of the tags

Use this resource to list the tags and branches for a given repository. This method supports the following parameters:

Parameter Required? Description
accountname Yes The team or individual account.
repo_slug Yes A repository belonging to the account.
https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/tags
  Click to view the data returned on success...

GET the raw source

Use this resource to get the raw content of a file or directory. This method supports the following parameters:

Parameter Required? Description
accountname Yes The team or individual account.
repo_slug Yes A repository belonging to the account.
revision  Ye A value representing the revision or branch to list.
path Yes  The path can be a filename or a directory path. If path ends with / it is interpreted as a directory and returns a list.

The following call gets a directory's content:

-v https://bitbucket.org/api/1.0/repositories/tutorials/tutorials.bitbucket.org/raw/default/images

Returns the content of the images directory which resides at the top of the default revision. This call shows the contents of the index.html file.

-v https://bitbucket.org/api/1.0/repositories/tutorials/tutorials.bitbucket.org/raw/default/index.html

The path is case sensitive so index.html is not the same as an Index.html file. Private repositories require the caller to authenticate as a user with access to the repository.

https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/raw/{revision}/{path}

Successful calls return HTTP/1.1 200 OK.

GETs the history of a file in a changeset

Returns the history of a file starting from the provided changeset. This method supports the following parameters:

Parameter Required? Description
accountname Yes The team or individual account.
repo_slug Yes A repository belonging to the account.
node Yes The simple changeset node id.
path Yes Filename.
https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/filehistory/{node}/{path}
  Click to view the data returned on success...

Was this helpful?

Thanks for your feedback!

2 Archived comments

  1. User avatar

    Anonymous

    The filehistory endpoint does not seem to return what it should. Instead it returns contents of the changeset it was part of.

    22 Jun 2013
  2. User avatar

    DJ Marcaida

    GET the repository manifest sample request is incorrect

    It should beĀ 

    https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/manifest/{revision}

    11 Mar 2015
Powered by Confluence and Scroll Viewport