Code Review
Functionality allowing people to review and approve the code.
- Attributes
- Searchable attributes
- Operations
GET /projects/:project_id/code_reviews
GET /projects/:project_id/code_reviews/:id
POST /projects/:project_id/code_reviews
PUT /projects/:project_id/code_reviews/:id
DELETE /projects/:project_id/code_reviews/:id
GET /projects/:project_id/code_reviews/count
PUT /projects/:project_id/code_reviews/:id/actions/merge
PUT /projects/:project_id/code_reviews/:id/actions/close
POST /projects/:project_id/code_reviews/:id/actions/vote
DELETE /projects/:project_id/code_reviews/:id/actions/unvote
Attributes
id
Automatically generated URL-friendly identifier for the code review.
- Type:
integer
- Immutable:
true
- Unique:
true
(in project scope) - Required:
true
title
Human-readable title for the code review.
- Type:
string
- Required:
true
- Minimum length:
1
- Maximum length:
100
description
Free-form description of the code review.
- Type:
string
- Default:
""
- Maximum length:
50000
voting_threshold
Number of required approvals.
- Type:
integer
- Default:
0
require_build
Whether or not the code review requires build.
- Type:
boolean
- Required:
true
state
Current state of the code review.
- Type:
string
merge_state
Current merge process state of the code review.
- Type:
string
head_branch
Name of the source.
- Type:
string
- Required:
true
head_branch_type
Type of the source. Allowed values (depends on repository type): branch
, bookmark
or tag
.
- Type:
string
- Required:
true
- Default:
branch
head_branch_id
Recent commit of the source.
- Type:
string
base_branch
Name of the destination.
- Type:
string
- Required:
true
base_branch_type
Type of the destination. Allowed values (depends on repository type): branch
, bookmark
or tag
.
- Type:
string
- Required:
true
- Default:
branch
base_branch_id
Recent commit of the destination.
- Type:
string
creator
Creator of the code review can be expanded to get the full User or Collaborator object by including the query parameter expand=creator
in the request.
- Type:
object
project
Project that the code review belongs to. Can be expanded to get the full Project object by including the query parameter expand=project
in the request.
- Type:
object
repository
Repository that the code review belongs to. Can be expanded to get the full Repository object by including the query parameter expand=repository
in the request.
- Type:
object
- Required:
true
Searchable attributes
Code reviews can be searched by their id
, title
, and description
attributes.
See the search documentation for instructions how to do this.
Operations
GET /projects/:project_id/code_reviews
Returns all the code reviews in the project, with optional limit and offset parameters, as a metadata-results object.
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/code_reviews
Example Response
{
"metadata": {
"more_results": false,
"next_offset": 1,
"count": 1
},
"results": [
{
"api_status": 200,
"api_timestamp": "2016-04-01T10:08:59Z",
"id": 2,
"created_at": "2016-04-01T10:00:53Z",
"updated_at": "2016-04-01T10:06:09Z",
"uuid": "1c5eaeda-312a-40f1-8e7f-24cbcfcecbb7",
"title": "Garbage collector for Git repositories",
"description": "Related issue: #333",
"voting_threshold": 2,
"state": "open",
"merge_state": "initial",
"creator": {
"id": "norris",
"uuid": "fdd36536-8a08-4e5b-ab25-6f7c975c9212",
"type": "user"
},
"head_branch": "develop",
"head_branch_type": "branch",
"head_commit_id": "746c7d5abbb99bfdb4ee255f313e625919b8a480",
"base_branch": "master",
"base_branch_type": "branch",
"base_commit_id": "06f6e74cc8bd98974fe206daeefa12dd8161d775",
"project": {
"id": "luotsi",
"uuid": "743be99c-d627-4733-8a4f-30472573a1fb"
},
"repository": {
"id": "chef",
"uuid": "87fe327c-b169-4b8f-84ea-131a59b39c28"
},
"require_build": false
}
]
}
GET /projects/:project_id/code_reviews/:id
Returns specific code review object.
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/code_reviews/2
Example Response
{
"api_status": 200,
"api_timestamp": "2016-04-01T10:04:07Z",
"id": 2,
"created_at": "2016-04-01T10:00:53Z",
"updated_at": "2016-04-01T10:00:53Z",
"uuid": "1c5eaeda-312a-40f1-8e7f-24cbcfcecbb7",
"title": "Garbage collector for Git repositories",
"description": "Related issue: #123",
"voting_threshold": 5,
"state": "open",
"merge_state": "initial",
"creator": {
"id": "norris",
"uuid": "fdd36536-8a08-4e5b-ab25-6f7c975c9212",
"type": "user"
},
"head_branch": "develop",
"head_branch_type": "branch",
"head_commit_id": "746c7d5abbb99bfdb4ee255f313e625919b8a480",
"base_branch": "master",
"base_branch_type": "branch",
"base_commit_id": "06f6e74cc8bd98974fe206daeefa12dd8161d775",
"project": {
"id": "luotsi",
"uuid": "743be99c-d627-4733-8a4f-30472573a1fb"
},
"repository": {
"id": "chef",
"uuid": "87fe327c-b169-4b8f-84ea-131a59b39c28"
},
"require_build": true
}
POST /projects/:project_id/code_reviews
Creates a new code review to the project. Returns the created code review object.
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 '{ "base_branch": "master", "head_branch": "develop", "repository": "chef", "base_branch_type": "branch", "head_branch_type": "branch", "voting_threshold": "5", "require_build": true, "title": "Garbage collector for Git repositories", "description": "Related issue: #123"}' \
https://helixteamhub.cloud/api/projects/luotsi/code_reviews
Example Response
{
"api_status": 201,
"api_timestamp": "2016-04-01T10:00:53Z",
"id": 2,
"created_at": "2016-04-01T10:00:53Z",
"updated_at": "2016-04-01T10:00:53Z",
"uuid": "1c5eaeda-312a-40f1-8e7f-24cbcfcecbb7",
"title": "Garbage collector for Git repositories",
"description": "Related issue: #123",
"voting_threshold": 5,
"state": "open",
"merge_state": "initial",
"creator": {
"id": "norris",
"uuid": "fdd36536-8a08-4e5b-ab25-6f7c975c9212",
"type": "user"
},
"head_branch": "develop",
"head_branch_type": "branch",
"head_commit_id": "746c7d5abbb99bfdb4ee255f313e625919b8a480",
"base_branch": "master",
"base_branch_type": "branch",
"base_commit_id": "06f6e74cc8bd98974fe206daeefa12dd8161d775",
"project": {
"id": "luotsi",
"uuid": "743be99c-d627-4733-8a4f-30472573a1fb"
},
"repository": {
"id": "chef",
"uuid": "87fe327c-b169-4b8f-84ea-131a59b39c28"
},
"require_build": true
}
PUT /projects/:project_id/code_reviews/:id
Updates the code review. Returns the updated code review object.
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 '{ "voting_threshold": "2", "require_build": false, "description": "Related issue: #333"}' \
https://helixteamhub.cloud/api/projects/luotsi/code_reviews/2
Example Response
{
"api_status": 200,
"api_timestamp": "2016-04-01T10:06:09Z",
"id": 2,
"created_at": "2016-04-01T10:00:53Z",
"updated_at": "2016-04-01T10:06:09Z",
"uuid": "1c5eaeda-312a-40f1-8e7f-24cbcfcecbb7",
"title": "Garbage collector for Git repositories",
"description": "Related issue: #333",
"voting_threshold": 2,
"state": "open",
"merge_state": "initial",
"creator": {
"id": "norris",
"uuid": "fdd36536-8a08-4e5b-ab25-6f7c975c9212",
"type": "user"
},
"head_branch": "develop",
"head_branch_type": "branch",
"head_commit_id": "746c7d5abbb99bfdb4ee255f313e625919b8a480",
"base_branch": "master",
"base_branch_type": "branch",
"base_commit_id": "06f6e74cc8bd98974fe206daeefa12dd8161d775",
"project": {
"id": "luotsi",
"uuid": "743be99c-d627-4733-8a4f-30472573a1fb"
},
"repository": {
"id": "chef",
"uuid": "87fe327c-b169-4b8f-84ea-131a59b39c28"
},
"require_build": false
}
DELETE /projects/:project_id/code_reviews/:id
Deletes the code review. Returns the deleted code review object.
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/code_reviews/2
GET /projects/:project_id/code_reviews/count
Returns count of code reviews.
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/code_reviews/count
Example Response
{
"api_status": 200,
"api_timestamp": "2016-04-01T10:10:39Z",
"count": 1
}
PUT /projects/:project_id/code_reviews/:id/actions/merge
Starts asynchronous merge of the code review. Returns the code review in processing state.
For git repositories a merge method can be specified by sending the merge_method
parameter. The following options are supported:
merge
(default)rebase
squash
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" \
https://helixteamhub.cloud/api/projects/luotsi/code_reviews/2/actions/merge
PUT /projects/:project_id/code_reviews/:id/actions/close
Closes the code review. Returns the code review in closed state.
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" \
https://helixteamhub.cloud/api/projects/luotsi/code_reviews/2/actions/close
POST /projects/:project_id/code_reviews/:id/actions/vote
Approves the code review by authorized account.
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" \
https://helixteamhub.cloud/api/projects/luotsi/code_reviews/2/actions/vote
DELETE /projects/:project_id/code_reviews/:id/actions/unvote
Withdraws approval for the code review.
Example Request
curl -X DELETE \
-H "Accept: application/vnd.hth.v1" \
-H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
-H "Content-Type: application/json" \
https://helixteamhub.cloud/api/projects/luotsi/code_reviews/2/actions/unvote