Jump to >

Review Diff Comment Resource

Name diff_comment
URI /api/review-requests/{review_request_id}/reviews/{review_id}/diff-comments/{comment_id}/
Description

Provides information on diff comments made on a review.

If the review is a draft, then comments can be added, deleted, or changed on this list. However, if the review is already published, then no changes can be made.

HTTP Methods
  • DELETE - Deletes the comment.
  • GET - Returns information on the comment.
  • PUT - Updates a diff comment.
Parent Resource Review Diff Comment List Resource
Child Resources None
Anonymous Access Yes, if anonymous site access is enabled

Fields

Field Type Description
filediff File Diff Resource The per-file diff that the comment was made on.
first_line Integer The line number that the comment starts at.
id Integer The numeric ID of the comment.
interfilediff File Diff Resource The second per-file diff in an interdiff that the comment was made on. This will be null if the comment wasn’t made on an interdiff.
issue_opened Boolean Whether or not a comment opens an issue.
issue_status One of dropped, open, resolved The status of an issue.
num_lines Integer The number of lines the comment spans.
public Boolean Whether or not the comment is part of a public review.
text String The comment text.
timestamp String The date and time that the comment was made (in YYYY-MM-DD HH:MM:SS format).
user User Resource The user who made the comment.

HTTP DELETE

Deletes the comment.

This will remove the comment from the review. This cannot be undone.

Only comments on draft reviews can be deleted. Attempting to delete a published comment will return a Permission Denied error.

Instead of a payload response, this will return HTTP 204 No Content.

HTTP GET

Returns information on the comment.

HTTP PUT

Updates a diff comment.

This can update the text or line range of an existing comment.

Request Parameters

Field Type Description
first_line (optional) Integer The line number the comment starts at.
issue_opened (optional) Boolean Whether or not the comment opens an issue.
issue_status (optional) One of dropped, open, resolved The status of an open issue.
num_lines (optional) Integer The number of lines the comment spans.
text (optional) String The comment text.

Examples

application/vnd.reviewboard.org.review-diff-comment+json

{
  "diff_comment": {
    "first_line": 12, 
    "id": 5, 
    "interfilediff": null, 
    "issue_opened": false, 
    "issue_status": "", 
    "links": {
      "delete": {
        "href": "http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/5/", 
        "method": "DELETE"
      }, 
      "filediff": {
        "href": "http://reviews.example.com/api/review-requests/8/diffs/3/files/41/", 
        "method": "GET", 
        "title": "/trunk/reviewboard/settings_local.py.tmpl (1797) -> /trunk/reviewboard/settings_local.py.tmpl ((working copy))"
      }, 
      "self": {
        "href": "http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/5/", 
        "method": "GET"
      }, 
      "update": {
        "href": "http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/5/", 
        "method": "PUT"
      }, 
      "user": {
        "href": "http://reviews.example.com/api/users/admin/", 
        "method": "GET", 
        "title": "admin"
      }
    }, 
    "num_lines": 3, 
    "public": true, 
    "text": "This is just a sample comment.", 
    "timestamp": "2010-08-22 17:25:41"
  }, 
  "stat": "ok"
}

application/vnd.reviewboard.org.review-diff-comment+xml

<?xml version="1.0" encoding="utf-8"?>
<rsp>
 <stat>ok</stat>
 <diff_comment>
  <issue_opened>0</issue_opened>
  <interfilediff>
  </interfilediff>
  <num_lines>3</num_lines>
  <links>
   <user>
    <href>http://reviews.example.com/api/users/admin/</href>
    <method>GET</method>
    <title>admin</title>
   </user>
   <self>
    <href>http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/5/</href>
    <method>GET</method>
   </self>
   <filediff>
    <href>http://reviews.example.com/api/review-requests/8/diffs/3/files/41/</href>
    <method>GET</method>
    <title>/trunk/reviewboard/settings_local.py.tmpl (1797) -&gt; /trunk/reviewboard/settings_local.py.tmpl ((working copy))</title>
   </filediff>
   <update>
    <href>http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/5/</href>
    <method>PUT</method>
   </update>
   <delete>
    <href>http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/5/</href>
    <method>DELETE</method>
   </delete>
  </links>
  <timestamp>2010-08-22 17:25:41</timestamp>
  <public>1</public>
  <text>This is just a sample comment.</text>
  <first_line>12</first_line>
  <id>5</id>
  <issue_status></issue_status>
 </diff_comment>
</rsp>