repository Resource
Overview
Use this resource to get information associated with an individual Bitbucket Cloud repository. You can use these calls with public or private repositories. Private repositories require the caller to authenticate with an account that has the appropriate authorization. You can also use the UUID of the repository for more information see, Universally Unique Identifier.
GET a repository
Returns a single repository.
Parameter | Required? | Description |
---|---|---|
owner | Yes | The accountname of the repo owner. |
repo_slug | Yes | The repository slug. |
GET https://api.bitbucket.org/2.0/repositories/{owner}/{repo_slug}
POST a new repository
To create a new repository, POST directly to the desired URL, providing a JSON request body that contains the properties of the new repository.
Parameter | Required? | Description |
---|---|---|
owner | Yes | The account of the repo owner. |
repo_slug | Yes | The repository slug. |
The POST body should match the repository object layout, but only a subset of its properties need to be specified:
Field name | Description |
---|---|
scm | The SCM type for the new repo. Either "hg" or "git". When omitted, the type of your most recently created repository will be used (optional). |
name | The name for the repository. When omitted, this assumes that value of the repo_slug part of the URL (optional). |
is_private | Whether the repository should be public (false) or private (true). |
description | The human readable description of the repository (optional). |
fork_policy | Control the rules for forking this repository. Available values are:
|
language | The programming language used in the repository. Must be a valid (lowercase) item as shown in the drop-down list on the repository's admin page (optional). |
has_issues | Whether the repository should have an issue tracker (optional – defaults to false). |
has_wiki | Whether the repository should have a wiki (optional – defaults to false). |
POST https://api.bitbucket.org/2.0/repositories/{owner}/{repo_slug}
$ curl -X POST -v -u username:password -H "Content-Type: application/json" \
https://api.bitbucket.org/2.0/repositories/teamsinspace/new-repository4 \
-d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }'
DELETE a repository
Removes a repository and any associated Wiki and Issue tracker. A 204 NO CONTENT
message is returned on success.
This is a destructive action which completely deletes the repository, issue tracker, and wiki. Be sure you have backed up all the data you need before deleting a repository.
Parameter | Required? | Description |
---|---|---|
owner | Yes | The account name of the repo owner. |
repo_slug | Yes | The repository slug. |
DELETE https://api.bitbucket.org/2.0/repositories/{owner}/{repo_slug}
GET a list of watchers
Gets the list of accounts watching a repository.
Parameter | Required? | Description |
---|---|---|
owner | Yes | The account of the repo owner. |
repo_slug | Yes | The repository slug. |
GET https://api.bitbucket.org/2.0/repositories/{owner}/{repo_slug}/watchers
GET a list of forks
Gets the list of repository forks, This call returns a repository object for each fork.
Parameter | Required? | Description |
---|---|---|
owner | Yes | The account of the repo owner. |
repo_slug | Yes | The repository slug. |