Repository

A repository is where the source code is stored. Repositories belong to a project. A project may have multiple repositories.

There are a number of types of repositories in Helix TeamHub: Git, Helix Git, Mercurial, Subversion, WebDAV, Maven, and Ivy.

Note

Forward slash characters in :id must be encoded with %2F

Attributes

id

The repository identifier/short name.

  • Type: string
  • Unique: true (within the project)
  • Required: true
  • Minimum length: 2
  • Maximum length: 100
  • Allowed characters: a-z, A-Z, 0-9, -, _ (and / only for Git)

type

One of Helix TeamHub's version control systems: git, helix_git, subversion, mercurial, webdav, maven, or ivy.

  • Type: string
  • Required: true
Note

When the helix_git type is used you must include the helix_path in the request, see helix_path for details.

helix_path

When the helix_git repo type is used you must include the helix_path in the request: "type":"helix_git", "helix_path":"//<project_name>/<repo_name>"

http_url

The HTTP(s) URL for version control access.

https_url

Deprecated, use http_url.

  • Type: string

ssh_url

The SSH URL for version control access. Not supported for WebDAV, Maven, or Ivy repositories.

  • Type: string

creator

Creator of the repository can be expanded to get the full User object by including the query parameter expand=creator in the request.

  • Type: object

hook_events

All hook events the repository supports.

  • Type: array

The hook_events array contains string identifiers of all the supported hook events.

"hook_events": ["push"]

default_identifier

The identifier used as a default for repository operations where the reference name is not provided.

  • Type: string
  • Default: master for Git, default for Mercurial, HEAD for Subversion, webdav for WebDAV, maven for Maven, and ivy for Ivy repositories.

default_base_branch

The default target reference for code reviews created inside the repository.

  • Type: string
  • Default: master for Git, default for Mercurial, HEAD for Subversion, webdav for WebDAV, maven for Maven, and ivy for Ivy repositories.

default_voting_threshold

The default number of required approvals for code reviews created inside the repository.

  • Type: integer
  • Default: 0

default_require_build

Whether or not build is required for code reviews created inside the repository.

  • Type: boolean
  • Default: false

enforce_voting

Enforces voting for code reviews created inside the repository.

  • Type: boolean
  • Default: false

enforce_build

Enforces build requirement for code reviews created inside the repository.

  • Type: boolean
  • Default: false

properties

See custom attributes for more information.

Searchable attributes

Repositories can be searched by their id attribute. See the search documentation for instructions how to do this.

Child objects

The following child objects can be attached to the repositories returned, to eliminate the need for requesting them separately:

Object Attribute
Branch branches
Tag tags
Hook hooks

For example, to get all of the repository branches and tags in full, attach include=branches,tags to your GET request.

See child object API documentation for a description of the possible operations.

Operations

GET /projects/:project_id/repositories

Returns all repositories for a project, with optional limit and offset parameters, as a metadata-results object.

GET /projects/:project_id/repositories/:id

Returns a single repository.

Example Request

curl -X GET \
  -H "Accept: application/vnd.hth.v1" \
  -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
  https://helixteamhub.cloud/api/projects/luotsi/repositories/luotsi

Example Response

{
  "api_status": 200,
  "api_timestamp": "2012-10-24T14:03:48Z",
  "id": "luotsi",
  "created_at": "2012-10-24T14:03:48Z",
  "updated_at": "2012-10-24T14:03:48Z",
  "type": "git",
  "ssh_url": "hth@helixteamhub.cloud:eficode/projects/luotsi/repositories/git/luotsi",
  "https_url": "https://helixteamhub.cloud/eficode/projects/luotsi/repositories/git/luotsi",
  "http_url": "https://helixteamhub.cloud/eficode/projects/luotsi/repositories/git/luotsi",
  "creator": {
    "id": "jp"
  },
  "hook_events": [
    "push"
  ],
  "properties": {

  }
}

POST /projects/:project_id/repositories

Creates a new repository for a project. Returns the created repository.

Example Request

curl -X POST \
  -H "Accept: application/vnd.hth.v1" \
  -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
  -H "Content-Type: application/json" \
  -d '{ "id": "foo", "type": "subversion" }' \
  https://helixteamhub.cloud/api/projects/luotsi/repositories

Example Response

{
  "api_status": 201,
  "api_timestamp": "2012-10-24T14:03:48Z",
  "id": "foo",
  "created_at": "2012-10-24T14:03:48Z",
  "updated_at": "2012-10-24T14:03:48Z",
  "type": "subversion",
  "ssh_url": "svn+ssh://hth@helixteamhub.cloud/acme/projects/luotsi/repositories/subversion/foo",
  "https_url": "https://helixteamhub.cloud/eficode/projects/luotsi/repositories/subversion/foo",
  "http_url": "https://helixteamhub.cloud/eficode/projects/luotsi/repositories/subversion/foo",
  "creator": {
    "id": "jp"
  },
  "hook_events": [
    "push"
  ],
  "properties": {

  }
}

PUT /projects/:project_id/repositories/:id

Updates a repository. Returns the updated repository.

Example Request

curl -X PUT \
  -H "Accept: application/vnd.hth.v1" \
  -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
  -H "Content-Type: application/json" \
  -d '{ "id": "bar" }' \
  https://helixteamhub.cloud/api/projects/luotsi/repositories/foo

Example Response

{
  "api_status": 200,
  "api_timestamp": "2012-10-24T14:03:48Z",
  "id": "foo",
  "created_at": "2012-10-24T14:03:48Z",
  "updated_at": "2012-10-24T14:03:48Z",
  "type": "subversion",
  "ssh_url": "svn+ssh://hth@helixteamhub.cloud/acme/projects/luotsi/repositories/subversion/foo",
  "https_url": "https://helixteamhub.cloud/eficode/projects/luotsi/repositories/subversion/foo",
  "http_url": "https://helixteamhub.cloud/eficode/projects/luotsi/repositories/subversion/foo",
  "creator": {
    "id": "jp"
  },
  "hook_events": [
    "push"
  ],
  "properties": {

  }
}

DELETE /projects/:project_id/repositories/:id

Deletes a repository. Returns the deleted repository.

Example Request

curl -X DELETE \
  -H "Accept: application/vnd.hth.v1" \
  -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
  https://helixteamhub.cloud/api/projects/luotsi/repositories/foo

Example Response

{
  "api_status": 200,
  "api_timestamp": "2012-10-24T14:03:48Z",
  "id": "foo",
  "created_at": "2012-10-24T14:03:48Z",
  "updated_at": "2012-10-24T14:03:48Z",
  "type": "subversion",
  "ssh_url": "svn+ssh://hth@helixteamhub.cloud/acme/projects/luotsi/repositories/subversion/foo",
  "https_url": "https://helixteamhub.cloud/eficode/projects/luotsi/repositories/subversion/foo",
  "http_url": "https://helixteamhub.cloud/eficode/projects/luotsi/repositories/subversion/foo",
  "creator": {
    "id": "jp"
  },
  "hook_events": [
    "push"
  ],
  "properties": {

  }
}