Review Diff Comment List Resource¶
Name | diff_comments |
URI | /api/review-requests/{review_request_id}/reviews/{review_id}/diff-comments/ |
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 | |
Parent Resource | Review Resource |
Child Resources | |
Anonymous Access | Yes, if anonymous site access is enabled |
Links¶
Name | Method | Resource |
---|---|---|
create | POST | Review Diff Comment List Resource |
self | GET | Review Diff Comment List Resource |
HTTP GET¶
Returns the list of comments made on a review.
This list can be filtered down by using the ?line= and ?interdiff-revision=.
To filter for comments that start on a particular line in the file, using ?line=.
To filter for comments that span revisions of diffs, you can specify the second revision in the range using ?interdiff-revision=.
Request Parameters¶
Field | Type | Description |
---|---|---|
counts-only (optional) | Boolean | If specified, a single count field is returned with the number of results, instead of the results themselves. |
interdiff-revision (optional) | Integer | The second revision in an interdiff revision range. The comments will be limited to this range. |
line (optional) | Integer | The line number that each comment must start on. |
max-results (optional) | Integer | The maximum number of results to return in this list. By default, this is 25. |
start (optional) | Integer | The 0-based index of the first result in the list. The start index is usually the previous start index plus the number of previous results. By default, this is 0. |
HTTP POST¶
Creates a new diff comment.
This will create a new diff comment on this review. The review must be a draft review.
Request Parameters¶
Field | Type | Description |
---|---|---|
filediff_id (required) | Integer | The ID of the file diff the comment is on. |
first_line (required) | Integer | The line number the comment starts at. |
interfilediff_id (optional) | Integer | The ID of the second file diff in the interdiff the comment is on. |
num_lines (required) | Integer | The number of lines the comment spans. |
text (required) | String | The comment text. |
Examples¶
application/json¶
{
"diff_comments": [
{
"first_line": 12,
"id": 5,
"interfilediff": null,
"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"
},
{
"first_line": 29,
"id": 6,
"interfilediff": null,
"links": {
"delete": {
"href": "http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/6/",
"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/6/",
"method": "GET"
},
"update": {
"href": "http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/6/",
"method": "PUT"
},
"user": {
"href": "http://reviews.example.com/api/users/admin/",
"method": "GET",
"title": "admin"
}
},
"num_lines": 3,
"public": true,
"text": "Another sample comment.",
"timestamp": "2010-08-22 17:25:52"
}
],
"links": {
"create": {
"href": "http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/",
"method": "POST"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/",
"method": "GET"
}
},
"stat": "ok",
"total_results": 2
}
application/xml¶
<?xml version="1.0" encoding="utf-8"?>
<rsp>
<total_results>2</total_results>
<stat>ok</stat>
<diff_comments>
<array>
<item>
<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) -> /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>
<id>5</id>
<text>This is just a sample comment.</text>
<first_line>12</first_line>
<public>1</public>
</item>
<item>
<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/6/</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) -> /trunk/reviewboard/settings_local.py.tmpl ((working copy))</title>
</filediff>
<update>
<href>http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/6/</href>
<method>PUT</method>
</update>
<delete>
<href>http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/6/</href>
<method>DELETE</method>
</delete>
</links>
<timestamp>2010-08-22 17:25:52</timestamp>
<id>6</id>
<text>Another sample comment.</text>
<first_line>29</first_line>
<public>1</public>
</item>
</array>
</diff_comments>
<links>
<self>
<href>http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/</href>
<method>GET</method>
</self>
<create>
<href>http://reviews.example.com/api/review-requests/8/reviews/8/diff-comments/</href>
<method>POST</method>
</create>
</links>
</rsp>