Beanstalk

Reviewed Commit Resource

Use this resource to get code review status (approved/not approved) for individual commits from your repository (both Git and SVN). This includes commits that were approved as part of code reviews that were performed on branches as well as commits that were approved individually via Changeset page’s Approve button.

New format

We are gradually phasing out XML support from our API and this is one of the first resources that are provided only in JSON format. The format was also a bit adjusted compared to other resources: associated objects (like repositories and users) are now embedded into JSON itself, and there are no JSON root elements anymore.

Attributes

revision string SVN revision number or Git commit hash.
committed_at datetime Date and time of the commit.
reviewed_at datetime Date and time when the commit has been marked as approved.
committer hash Embedded User object.
id integer ID of the User who made the commit.
name integer Name of the User who made the commit.
reviewer hash Embedded User object.
id integer ID of the User who reviewed the commit.
name integer Name of the User who reviewed the commit.
code_review hash Embedded User object.
id integer Code Review ID.
description string Description of the branch provided by user.
target_branch string Name of the branch that’s being reviewed.
source_branch string Name of the branch to which target_branch should be compared to.
merge boolean True if user who requested the review wanted target_branch to be merged into source_branch when review is approved.
state string Current state of the Code Review. Can be: new, reopened, approved, cancelled.
updated_at datetime Timestamp that gets updated every time something changes inside the Code Review.
created_at datetime Date and time of when the Code Review has been requested.

Get review status for a commit

Returns a 404 error if commit has not been approved yet or returns detailed information about the person who approved the commit, when it happened and attaches an associated CodeReview object if the commit was approved as part of a branch code review.

json http-request
GET /api/{REPOSITORY_ID}/reviewed_commits/{REVISION}.json

Click to expand…

json http-response
{
  "revision": "9127d0e38a799efe5a2130a49dab1d34a5ec4f93",
  "committed_at": "2014/12/12 01:18:29 +0000",
  "reviewed_at": "2015/09/21 16:39:07 +0000",
  "committer": {
    "id": 1,
    "name": "Ilya Sabanin"
  },
  "reviewer": {
    "id": 1,
    "name": "Ilya Sabanin"
  }
}

Mark commit as approved

Marks an individual commit from your repository as approved. This review status will show up on Changeset page inside Beanstalk. Firing this endpoint is identical to clicking Approve button on Changeset page.

The endpoint will return status 201 if commit was approved based on your request or status 200 if it was approved previously.

json http-request
POST /api/{REPOSITORY_ID}/reviewed_commits/{REVISION}.json

Click to expand…

json http-response
{
  "revision": "9127d0e38a799efe5a2130a49dab1d34a5ec4f93",
  "committed_at": "2014/12/12 01:18:29 +0000",
  "reviewed_at": "2015/09/21 16:39:07 +0000",
  "committer": {
    "id": 1,
    "name": "Ilya Sabanin"
  },
  "reviewer": {
    "id": 1,
    "name": "Ilya Sabanin"
  }
}

Mark commit as unapproved

Marks an individual commit as no longer approved. All commits in a repository are unapproved by default so this endpoint only makes sense for removing previously set approved status. Will return 404 if commit has not been previously approved.

json http-request
DELETE /api/{REPOSITORY_ID}/reviewed_commits/{REVISION}.json

Click to expand…

json http-response
HEAD 200