Jump to >

Repository Branches Resource

Added in 2.0

Provides information on the branches in a repository.

Data on branches will not be available for all types of repositories.

Details

Name branches
URI /api/repositories/{repository_id}/branches/
HTTP Methods
  • GET - Retrieves an array of the branches in a repository.
Parent Resource Repository Resource
Child Resources None
Anonymous Access Yes, if anonymous site access is enabled

Fields

commitString

The revision identifier of the commit.

The format depends on the repository type (it may be a number, SHA-1 hash, or some other type). This should be treated as a relatively opaque value, but can be used as the start parameter to the Repository Commits Resource.

defaultBoolean

If set, this branch is considered the “tip” of the repository. It would represent “master” for Git repositories, “trunk” for Subversion, etc.

This will be true for exactly one of the results only. All others will be false.

idString The ID of the branch. This is specific to the type of repository.
nameString The name of the branch.

HTTP GET

Retrieves an array of the branches in a repository.

Errors

100 - Does Not ExistHTTP 404 - Not Found Object does not exist
101 - Permission DeniedHTTP 403 - Forbidden You don’t have permission for this
103 - Not Logged InHTTP 401 - Unauthorized You are not logged in
209 - Repository Action Not SupportedHTTP 501 - Not Implemented The specified repository is not able to perform this action.
210 - Repository Information ErrorHTTP 500 - Internal Server Error There was an error fetching extended information for this repository.

Examples

application/vnd.reviewboard.org.repository-branches+json

$ curl http://reviews.example.com/api/repositories/1/branches/ -H "Accept: application/json"
Vary: Accept, Cookie
Content-Type: application/vnd.reviewboard.org.repository-branches+json
X-Content-Type-Options: nosniff
{
  "branches": [
    {
      "commit": "2200", 
      "default": true, 
      "id": "trunk", 
      "name": "trunk"
    }, 
    {
      "commit": "2105", 
      "default": false, 
      "id": "branches/reviewboard", 
      "name": "reviewboard"
    }, 
    {
      "commit": "2096", 
      "default": false, 
      "id": "releases", 
      "name": "releases"
    }, 
    {
      "commit": "2201", 
      "default": false, 
      "id": "wiki", 
      "name": "wiki"
    }
  ], 
  "stat": "ok"
}