Jump to >

Repository List Resource

Name repositories
URI /api/repositories/
Description

Provides information on a registered repository.

Review Board has a list of known repositories, which can be modified through the site’s administration interface. These repositories contain the information needed for Review Board to access the files referenced in diffs.

HTTP Methods
  • GET - Retrieves the list of repositories on the server.
  • POST - Creates a repository.
Parent Resource Root List Resource
Child Resources
Anonymous Access Yes, if anonymous site access is enabled

HTTP GET

Retrieves the list of repositories on the server.

This will only list visible repositories. Any repository that the administrator has hidden will be excluded from the list.

Request Parameters

Field Type Description
counts-only (optional) Boolean If specified, a single count field is returned with the number of results, instead of the results themselves.
hosting-service (optional) String Filter repositories by one or more comma-separated hosting service IDs.
max-results (optional) Integer The maximum number of results to return in this list. By default, this is 25. There is a hard limit of 200; if you need more than 200 results, you will need to make more than one request, using the “next” pagination link.
name (optional) String Filter repositories by one or more comma-separated names.
name-or-path (optional) String Filter repositories by one or more comma-separated names, paths, or mirror paths.
path (optional) String Filter repositories by one or more comma-separated paths or mirror paths.
start (optional) Integer The 0-based index of the first result in the list. The start index is usually the previous start index plus the number of previous results. By default, this is 0.
tool (optional) String Filter repositories by one or more comma-separated tool names.
username (optional) String Filter repositories by one or more comma-separated usernames.

HTTP POST

Creates a repository.

This will create a new repository that can immediately be used for review requests.

The tool is a registered SCMTool ID. This must be known beforehand, and can be looked up in the Review Board administration UI.

Before saving the new repository, the repository will be checked for access. On success, the repository will be created and this will return HTTP 201 Created.

In the event of an access problem (authentication problems, bad/unknown SSH key, or unknown certificate), an error will be returned and the repository information won’t be updated. Pass trust_host=1 to approve bad/unknown SSH keys or certificates.

Request Parameters

Field Type Description
bug_tracker (optional) String The URL to a bug in the bug tracker for this repository, with %s in place of the bug ID.
encoding (optional) String The encoding used for files in the repository. This is an advanced setting and should only be used if you absolutely need it.
mirror_path (optional) String An alternate path to the repository.
name (required) String The human-readable name of the repository.
password (optional) String The password used to access the repository.
path (required) String The path to the repository.
public (optional) Boolean Whether or not review requests on the repository will be publicly accessible by users on the site. The default is true.
raw_file_url (optional) String A URL mask used to check out a particular file using HTTP. This is needed for repository types that can’t access files natively. Use <revision> and <filename> in the URL in place of the revision and filename parts of the path.
tool (required) String The ID of the SCMTool to use.
trust_host (optional) Boolean Whether or not any unknown host key or certificate should be accepted. The default is false, in which case this will error out if encountering an unknown host key or certificate.
username (optional) String The username used to access the repository.

Errors

Examples

application/vnd.reviewboard.org.repositories+json

{
  "links": {
    "create": {
      "href": "http://reviews.example.com/api/repositories/", 
      "method": "POST"
    }, 
    "self": {
      "href": "http://reviews.example.com/api/repositories/", 
      "method": "GET"
    }
  }, 
  "repositories": [
    {
      "id": 1, 
      "links": {
        "delete": {
          "href": "http://reviews.example.com/api/repositories/1/", 
          "method": "DELETE"
        }, 
        "info": {
          "href": "http://reviews.example.com/api/repositories/1/info/", 
          "method": "GET"
        }, 
        "self": {
          "href": "http://reviews.example.com/api/repositories/1/", 
          "method": "GET"
        }, 
        "update": {
          "href": "http://reviews.example.com/api/repositories/1/", 
          "method": "PUT"
        }
      }, 
      "mirror_path": "", 
      "name": "Review Board SVN", 
      "path": "http://reviewboard.googlecode.com/svn", 
      "tool": "Subversion"
    }, 
    {
      "id": 2, 
      "links": {
        "delete": {
          "href": "http://reviews.example.com/api/repositories/2/", 
          "method": "DELETE"
        }, 
        "info": {
          "href": "http://reviews.example.com/api/repositories/2/info/", 
          "method": "GET"
        }, 
        "self": {
          "href": "http://reviews.example.com/api/repositories/2/", 
          "method": "GET"
        }, 
        "update": {
          "href": "http://reviews.example.com/api/repositories/2/", 
          "method": "PUT"
        }
      }, 
      "mirror_path": "", 
      "name": "Navi SVN", 
      "path": "http://svn.navi.cx/misc", 
      "tool": "Subversion"
    }
  ], 
  "stat": "ok", 
  "total_results": 2
}

application/vnd.reviewboard.org.repositories+xml

<?xml version="1.0" encoding="utf-8"?>
<rsp>
 <total_results>2</total_results>
 <stat>ok</stat>
 <repositories>
  <array>
   <item>
    <name>Review Board SVN</name>
    <links>
     <info>
      <href>http://reviews.example.com/api/repositories/1/info/</href>
      <method>GET</method>
     </info>
     <self>
      <href>http://reviews.example.com/api/repositories/1/</href>
      <method>GET</method>
     </self>
     <update>
      <href>http://reviews.example.com/api/repositories/1/</href>
      <method>PUT</method>
     </update>
     <delete>
      <href>http://reviews.example.com/api/repositories/1/</href>
      <method>DELETE</method>
     </delete>
    </links>
    <mirror_path></mirror_path>
    <id>1</id>
    <path>http://reviewboard.googlecode.com/svn</path>
    <tool>Subversion</tool>
   </item>
   <item>
    <name>Navi SVN</name>
    <links>
     <info>
      <href>http://reviews.example.com/api/repositories/2/info/</href>
      <method>GET</method>
     </info>
     <self>
      <href>http://reviews.example.com/api/repositories/2/</href>
      <method>GET</method>
     </self>
     <update>
      <href>http://reviews.example.com/api/repositories/2/</href>
      <method>PUT</method>
     </update>
     <delete>
      <href>http://reviews.example.com/api/repositories/2/</href>
      <method>DELETE</method>
     </delete>
    </links>
    <mirror_path></mirror_path>
    <id>2</id>
    <path>http://svn.navi.cx/misc</path>
    <tool>Subversion</tool>
   </item>
  </array>
 </repositories>
 <links>
  <self>
   <href>http://reviews.example.com/api/repositories/</href>
   <method>GET</method>
  </self>
  <create>
   <href>http://reviews.example.com/api/repositories/</href>
   <method>POST</method>
  </create>
 </links>
</rsp>