RepositoryResource Resource

Repository related RESTful Web Service Endpoint.

GET /api/rest/repositories

Returns all repositories.

Request Parameters
name type description default constraints
desc query sort direction desc or aesc false boolean
limit query the limit value for paging -1 int
sortby query sort parameter    
start query the start value for paging 0 int
Response Codes
code condition
200 success
500 internal server error
Response Body
media type data type description
application/json array of Repository (JSON) all repositories
application/xml list of repository (XML)

Example

Request
GET /repositories
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
[ {
  "contact" : "...",
  "creationDate" : 12345,
  "description" : "...",
  "healthCheckFailures" : [ {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  }, {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  } ],
  "id" : "...",
  "lastModified" : 12345,
  "name" : "...",
  "permissions" : [ {
    "groupPermission" : true,
    "name" : "...",
    "type" : "WRITE"
  }, {
    "groupPermission" : true,
    "name" : "...",
    "type" : "WRITE"
  } ],
  "public" : true,
  "archived" : true,
  "type" : "...",
  "properties" : [ {
    "key" : "...",
    "value" : "..."
  }, {
    "key" : "...",
    "value" : "..."
  } ]
} ]
                
              

POST /api/rest/repositories

Creates a new repository.Note: This method requires admin privileges.

Request Body
media type data type description
application/json Repository (JSON) the repository to be created
application/xml repository (XML)
Response Codes
code condition
201 success
403 forbidden, the current user has no admin privileges
500 internal server error

Example

Request
POST /repositories
Content-Type: application/json

                
{
  "contact" : "...",
  "creationDate" : 12345,
  "description" : "...",
  "healthCheckFailures" : [ {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  }, {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  } ],
  "id" : "...",
  "lastModified" : 12345,
  "name" : "...",
  "permissions" : [ {
    "groupPermission" : true,
    "name" : "...",
    "type" : "OWNER"
  }, {
    "groupPermission" : true,
    "name" : "...",
    "type" : "READ"
  } ],
  "public" : true,
  "archived" : true,
  "type" : "...",
  "properties" : [ {
    "key" : "...",
    "value" : "..."
  }, {
    "key" : "...",
    "value" : "..."
  } ]
}
                
              
Response
HTTP/1.1 201 Created

              

DELETE /api/rest/repositories/{id}

Deletes a repository. Note: This method requires owner privileges.

Request Parameters
name type description
id path the id of the repository to delete.
Response Codes
code condition
204 delete success
403 forbidden, the current user has no owner privileges
404 could not find repository
412 precondition failed, the repository is not archived, this error occurs only with enabled repository archive
500 internal server error

Example

Request
DELETE /repositories/{id}

              
Response
HTTP/1.1 204 No Content

              

GET /api/rest/repositories/{id}

Returns the Repository with the specified id.

Request Parameters
name type description
id path the id/name of the user
Response Codes
code condition
200 success
404 not found, no repository with the specified id available
500 internal server error
Response Body
media type data type description
application/json Repository (JSON) the Repository with the specified id
application/xml repository (XML)

Example

Request
GET /repositories/{id}
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "contact" : "...",
  "creationDate" : 12345,
  "description" : "...",
  "healthCheckFailures" : [ {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  }, {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  } ],
  "id" : "...",
  "lastModified" : 12345,
  "name" : "...",
  "permissions" : [ {
    "groupPermission" : true,
    "name" : "...",
    "type" : "OWNER"
  }, {
    "groupPermission" : true,
    "name" : "...",
    "type" : "READ"
  } ],
  "public" : true,
  "archived" : true,
  "type" : "...",
  "properties" : [ {
    "key" : "...",
    "value" : "..."
  }, {
    "key" : "...",
    "value" : "..."
  } ]
}
                
              

PUT /api/rest/repositories/{id}

Modifies the given repository. Note: This method requires owner privileges.

Request Parameters
name type description
id path id of the repository to be modified
Request Body
media type data type description
application/json Repository (JSON) repository object to modify
application/xml repository (XML)
Response Codes
code condition
204 update successful
403 forbidden, the current user has no owner privileges
404 could not find repository
500 internal server error

Example

Request
PUT /repositories/{id}
Content-Type: application/json

                
{
  "contact" : "...",
  "creationDate" : 12345,
  "description" : "...",
  "healthCheckFailures" : [ {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  }, {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  } ],
  "id" : "...",
  "lastModified" : 12345,
  "name" : "...",
  "permissions" : [ {
    "groupPermission" : true,
    "name" : "...",
    "type" : "OWNER"
  }, {
    "groupPermission" : true,
    "name" : "...",
    "type" : "OWNER"
  } ],
  "public" : true,
  "archived" : true,
  "type" : "...",
  "properties" : [ {
    "key" : "...",
    "value" : "..."
  }, {
    "key" : "...",
    "value" : "..."
  } ]
}
                
              
Response
HTTP/1.1 204 No Content

              

GET /api/rest/repositories/{id}/blame

Returns a annotate/blame view for the given path.

Request Parameters
name type description
id path the id of the repository
path query the path of the file
revision query the revision of the file
Response Codes
code condition
200 success
400 bad request, the blame feature is not supported by this type of repositories.
404 not found, the repository or the path could not be found
500 internal server error
Response Body
media type data type description
application/json BlameResult (JSON) a annotate/blame view for the given path
application/xml blameResult (XML)

Example

Request
GET /repositories/{id}/blame
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "blamelines" : [ {
    "description" : "...",
    "author" : {
      "mail" : "...",
      "name" : "..."
    },
    "revision" : "...",
    "lineNumber" : 12345,
    "when" : 12345,
    "code" : "..."
  }, {
    "description" : "...",
    "author" : {
      "mail" : "...",
      "name" : "..."
    },
    "revision" : "...",
    "lineNumber" : 12345,
    "when" : 12345,
    "code" : "..."
  } ],
  "total" : 12345
}
                
              
Available Since
1.18

GET /api/rest/repositories/{id}/branches

Returns all Branches of a repository.

Available Since
1.18
Request Parameters
name type description
id path the id of the repository
Response Codes
code condition
200 success
400 bad request, the branch feature is not supported by this type of repositories.
404 not found, the repository could not be found
500 internal server error
Response Body
media type data type description
application/json Branches (JSON) all Branches of a repository
application/xml branches (XML)

Example

Request
GET /repositories/{id}/branches
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "branch" : [ {
    "name" : "...",
    "revision" : "..."
  }, {
    "name" : "...",
    "revision" : "..."
  } ]
}
                
              

GET /api/rest/repositories/{id}/browse

Returns a list of folders and files for the given folder.

Request Parameters
name type description default constraints
id path the id of the repository    
disableLastCommit query true disables fetch of last commit message false boolean
disableSubRepositoryDetection query true disables sub repository detection false boolean
path query the path of the folder    
recursive query true to enable recursive browsing false boolean
revision query the revision of the file    
Response Codes
code condition
200 success
400 bad request, the browse feature is not supported by this type of repositories.
404 not found, the repository or the path could not be found
500 internal server error
Response Body
media type data type description
application/json BrowserResult (JSON) a list of folders and files for the given folder
application/xml browserResult (XML)

Example

Request
GET /repositories/{id}/browse
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "branch" : "...",
  "files" : [ {
    "description" : "...",
    "directory" : true,
    "lastModified" : 12345,
    "length" : 12345,
    "name" : "...",
    "path" : "...",
    "subrepository" : {
      "browser-url" : "...",
      "repository-url" : "...",
      "revision" : "..."
    }
  }, {
    "description" : "...",
    "directory" : true,
    "lastModified" : 12345,
    "length" : 12345,
    "name" : "...",
    "path" : "...",
    "subrepository" : {
      "browser-url" : "...",
      "repository-url" : "...",
      "revision" : "..."
    }
  } ],
  "revision" : "...",
  "tag" : "..."
}
                
              

GET /api/rest/repositories/{id}/changesets

Returns a list of Changeset for the given repository.

Request Parameters
name type description default constraints
id path the id of the repository    
branch query name of the branch    
limit query the limit value for paging 20 int
path query path of a file    
revision query the revision of the file specified by the path parameter    
start query the start value for paging 0 int
Response Codes
code condition
200 success
400 bad request, the changeset feature is not supported by this type of repositories.
404 not found, the repository or the path could not be found
500 internal server error
Response Body
media type data type description
application/json ChangesetPagingResult (JSON) a list of Changeset for the given repository
application/xml changesetPagingResult (XML)

Example

Request
GET /repositories/{id}/changesets
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "changesets" : [ {
    "author" : {
      "mail" : "...",
      "name" : "..."
    },
    "branches" : [ "...", "..." ],
    "date" : 12345,
    "description" : "...",
    "id" : "...",
    "modifications" : {
      "added" : [ "...", "..." ],
      "modified" : [ "...", "..." ],
      "removed" : [ "...", "..." ]
    },
    "parents" : [ "...", "..." ],
    "tags" : [ "...", "..." ],
    "properties" : [ {
      "key" : "...",
      "value" : "..."
    }, {
      "key" : "...",
      "value" : "..."
    } ]
  }, {
    "author" : {
      "mail" : "...",
      "name" : "..."
    },
    "branches" : [ "...", "..." ],
    "date" : 12345,
    "description" : "...",
    "id" : "...",
    "modifications" : {
      "added" : [ "...", "..." ],
      "modified" : [ "...", "..." ],
      "removed" : [ "...", "..." ]
    },
    "parents" : [ "...", "..." ],
    "tags" : [ "...", "..." ],
    "properties" : [ {
      "key" : "...",
      "value" : "..."
    }, {
      "key" : "...",
      "value" : "..."
    } ]
  } ],
  "total" : 12345
}
                
              

GET /api/rest/repositories/{id}/content

Returns the content of a file.

Request Parameters
name type description
id path the id of the repository
path query path to the file
revision query the revision of the file
Response Codes
code condition
200 success
400 bad request, the content feature is not supported by this type of repositories.
404 not found, the repository or the path could not be found
500 internal server error
Response Body
media type data type description
application/octet-stream (custom) the content of a file

Example

Request
GET /repositories/{id}/content
Accept: application/octet-stream

              
Response
HTTP/1.1 200 OK
Content-Type: application/octet-stream

                
...
                
              

GET /api/rest/repositories/{id}/diff

Returns the modifications of a Changeset.

Request Parameters
name type description constraints
id path the id of the repository  
format query "GIT" or "NATIVE" or "UNIFIED"
path query path to the file  
revision query the revision of the file  
Response Codes
code condition
200 success
400 bad request, the diff feature is not supported by this type of repositories.
404 not found, the repository or the path could not be found
500 internal server error
Response Body
media type data type description
application/octet-stream (custom) the modifications of a Changeset

Example

Request
GET /repositories/{id}/diff
Accept: application/octet-stream

              
Response
HTTP/1.1 200 OK
Content-Type: application/octet-stream

                
...
                
              

POST /api/rest/repositories/{id}/healthcheck

Re run repository health checks.

Request Parameters
name type description
id path id of the repository
Response Codes
code condition
200 re run success
403 forbidden, the current user has no owner privileges
404 could not find repository
500 internal server error

Example

Request
POST /repositories/{id}/healthcheck

              
Response
HTTP/1.1 200 OK

              
Available Since
1.18

GET /api/rest/repositories/{id}/tags

Returns all Tags of a repository.

Available Since
1.18
Request Parameters
name type description
id path the id of the repository
Response Codes
code condition
200 success
400 bad request, the tag feature is not supported by this type of repositories.
404 not found, the repository could not be found
500 internal server error
Response Body
media type data type description
application/json Tags (JSON) all Tags of a repository
application/xml tags (XML)

Example

Request
GET /repositories/{id}/tags
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "tag" : [ {
    "name" : "...",
    "revision" : "..."
  }, {
    "name" : "...",
    "revision" : "..."
  } ]
}
                
              

GET /api/rest/repositories/{type}/{name}

Returns the Repository with the specified type and name.

Request Parameters
name type description constraints
name path the name of the repository regex: .*
type path the type of the repository regex: [a-z]+
Response Codes
code condition
200 success
404 not found, no repository with the specified type and name available
500 internal server error
Response Body
media type data type description
application/json Repository (JSON) the Repository with the specified type and name
application/xml repository (XML)

Example

Request
GET /repositories/{type}/{name}
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "contact" : "...",
  "creationDate" : 12345,
  "description" : "...",
  "healthCheckFailures" : [ {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  }, {
    "description" : "...",
    "id" : "...",
    "summary" : "...",
    "url" : "..."
  } ],
  "id" : "...",
  "lastModified" : 12345,
  "name" : "...",
  "permissions" : [ {
    "groupPermission" : true,
    "name" : "...",
    "type" : "WRITE"
  }, {
    "groupPermission" : true,
    "name" : "...",
    "type" : "READ"
  } ],
  "public" : true,
  "archived" : true,
  "type" : "...",
  "properties" : [ {
    "key" : "...",
    "value" : "..."
  }, {
    "key" : "...",
    "value" : "..."
  } ]
}
                
              

GET /api/rest/repositories/{id}/changeset/{revision}

Returns the Changeset from the given repository with the specified revision.

Request Parameters
name type description
id path the id of the repository
revision path the revision of the changeset
Response Codes
code condition
200 success
400 bad request, the changeset feature is not supported by this type of repositories.
404 not found, the repository or the revision could not be found
500 internal server error
Response Body
media type data type description
application/json Changeset (JSON) a Changeset from the given repository
application/xml changeset (XML)

Example

Request
GET /repositories/{id}/changeset/{revision}
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "author" : {
    "mail" : "...",
    "name" : "..."
  },
  "branches" : [ "...", "..." ],
  "date" : 12345,
  "description" : "...",
  "id" : "...",
  "modifications" : {
    "added" : [ "...", "..." ],
    "modified" : [ "...", "..." ],
    "removed" : [ "...", "..." ]
  },
  "parents" : [ "...", "..." ],
  "tags" : [ "...", "..." ],
  "properties" : [ {
    "key" : "...",
    "value" : "..."
  }, {
    "key" : "...",
    "value" : "..."
  } ]
}