Beanstalk

Code Review Issue Resource

This resource represents Issues from Code Review’s Issues sub-page. Any user with at least read access to a repository can add issues to any Code Review. Issues can be added to specific lines of code or to the Code Review as a whole. This API doesn’t support creation of Issues for lines of code.

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.

Readable attributes

id integer Issue ID.
resolved_at datetime Date and time when issue was resolved.
resolved_by_user hash Embedded object of the User who resolved the issue.
id integer User ID.
name string User full name.
login string User login.
email string User email address.
comment hash Embedded Comment object that represents the Issue.
body string Comment text (Markdown source.)
rendered_body string Comment text (HTML.)
line_num integer Line number if comment was made for a line of code. For comments made on diff pieces this will be right line number.
line_num_left integer Left line number. For comments created on diff pieces.
file_path string File path for which comment was created
line_contents string For comments created on lines of code only. Contains contents of the line on which the comment was made.
revision string Revision number (or SHA1 hash) of the associated commit.
created_at datetime Date and time when the comment was created.
updated_at datetime Date and time when the comment was last updated.
author hash Comment author.
id integer User ID.
name string User full name.
login string User login.
email string User email address.

Writable attributes

body string Issue text with Markdown formatting.

Find All Issues for Code Review

Optional GET parameters:

  • page (integer) — page number for pagination.
  • per_page (integer) — number of elements per page (default 25, maximum 100);
  • order (string) — date order direction. Should be either ASC or DESC (default is DESC);
  • open (boolean) — only return open issues;
  • resolved (boolean) — only return resolved issues.
json http-request
GET /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/issues.json

Click to expand…

json http-response
{
  "page": 1,
  "per_page": 25,
  "total_pages": 1,
  "page_entries": 1,
  "total_entries": 1,
  "issues": [
    {
      "id": 1,
      "resolved_at": "2014/12/30 09:57:07 -0500",
      "resolved_by_user": {
        "id": 1,
        "name": "Ilya Sabanin",
        "login": "ilya",
        "email": "ilya@example.com"
      },
      "comment": {
        "body": "test",
        "rendered_body": "<p>test</p>\n",
        "line_num": null,
        "line_num_left": null,
        "file_path": null,
        "line_contents": null,
        "revision": null,
        "created_at": "2014/12/29 21:31:44 -0500",
        "updated_at": "2014/12/29 21:31:44 -0500",
        "author": {
          "id": 1,
          "name": "Ilya Sabanin",
          "login": "ilya",
          "email": "ilya@example.com"
        }
      }
    }
  ]
}

Find Issue by ID

json http-request
GET /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/issues/{ISSUE_ID}.json

Click to expand…

json http-response
{
  "id": 1,
  "resolved_at": "2014/12/30 09:57:07 -0500",
  "resolved_by_user": {
    "id": 1,
    "name": "Ilya Sabanin",
    "login": "ilya",
    "email": "ilya@example.com"
  },
  "comment": {
    "body": "test",
    "rendered_body": "<p>test</p>\n",
    "line_num": null,
    "line_num_left": null,
    "file_path": null,
    "line_contents": null,
    "revision": null,
    "created_at": "2014/12/29 21:31:44 -0500",
    "updated_at": "2014/12/29 21:31:44 -0500",
    "author": {
      "id": 1,
      "name": "Ilya Sabanin",
      "login": "ilya",
      "email": "ilya@example.com"
    }
  }
}

Add Issue to Code Review

json http-request
POST /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/issues.json

{
  "issue": {
    "body": "Fix bug"
  }
}

Click to expand…

json http-response
{
  "id":3,
  "resolved_at":null,
  "comment":{
    "body":"Fix bug",
    "rendered_body":"<p>Fix bug</p>\n",
    "line_num":null,
    "line_num_left":null,
    "file_path":null,
    "line_contents":null,
    "revision":null,
    "created_at":"2014/12/31 10:37:24 -0500",
    "updated_at":"2014/12/31 10:37:24 -0500",
    "author":{
      "id":1,
      "name":"Ilya Sabanin",
      "login":"ilya",
      "email":"ilya@example.com"
    }
  }
}

Mark Issue as Resolved

json http-request
PUT /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/issues/{ISSUE_ID}/resolve.json

Click to expand…

json http-response
STATUS: 200

{
  "id": 1,
  "resolved_at": "2014/12/30 09:57:07 -0500",
  "resolved_by_user": {
    "id": 1,
    "name": "Ilya Sabanin",
    "login": "ilya",
    "email": "ilya@example.com"
  },
  "comment": {
    "body": "test",
    "rendered_body": "<p>test</p>\n",
    "line_num": null,
    "line_num_left": null,
    "file_path": null,
    "line_contents": null,
    "revision": null,
    "created_at": "2014/12/29 21:31:44 -0500",
    "updated_at": "2014/12/29 21:31:44 -0500",
    "author": {
      "id": 1,
      "name": "Ilya Sabanin",
      "login": "ilya",
      "email": "ilya@example.com"
    }
  }
}

Mark Issue as Unresolved

json http-request
PUT /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/issues/{ISSUE_ID}/reopen.json

Click to expand…

json http-response
STATUS: 200

{
  "id": 1,
  "resolved_at": null,
  "comment": {
    "body": "test",
    "rendered_body": "<p>test</p>\n",
    "line_num": null,
    "line_num_left": null,
    "file_path": null,
    "line_contents": null,
    "revision": null,
    "created_at": "2014/12/29 21:31:44 -0500",
    "updated_at": "2014/12/29 21:31:44 -0500",
    "author": {
      "id": 1,
      "name": "Ilya Sabanin",
      "login": "ilya",
      "email": "ilya@example.com"
    }
  }
}

Delete Issue

json http-request
DELETE /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/issues/{ISSUE_ID}.json

Click to expand…

json http-response
HEAD 200 OK