Diff List Resource¶
Provides information on a collection of complete diffs.
Each diff contains individual per-file diffs as child resources. A diff is revisioned, and more than one can be associated with any particular review request.
Details¶
Name | diffs |
URI | /api/review-requests/{review_request_id}/diffs/ |
Token Policy ID | diff |
HTTP Methods | |
Parent Resource | Review Request Resource |
Child Resources | |
Anonymous Access | Yes, if anonymous site access is enabled |
Links¶
Name | Method | Resource |
---|---|---|
create | POST | Diff List Resource |
self | GET | Diff List Resource |
HTTP GET¶
Returns the list of public diffs on the review request.
Each diff has a revision and list of per-file diffs associated with it.
Errors¶
100 - Does Not ExistHTTP 404 - Not Found | Object does not exist |
101 - Permission DeniedHTTP 403 - Forbidden | You don’t have permission for this |
103 - Not Logged InHTTP 401 - Unauthorized | You are not logged in |
112 - OAuth2 Missing Scope ErrorHTTP 403 - Forbidden | Your OAuth2 token lacks the necessary scopes for this request. |
113 - OAuth2 Access Denied ErrorHTTP 403 - Forbidden | OAuth2 token access for this resource is prohibited. |
HTTP POST¶
Creates a new diff by parsing an uploaded diff file.
This will implicitly create the new Review Request draft, which can be updated separately and then published.
This accepts a unified diff file, validates it, and stores it along with the draft of a review request. The new diff will have a revision of 0.
A parent diff can be uploaded along with the main diff. A parent diff is a diff based on an existing commit in the repository, which will be applied before the main diff. The parent diff will not be included in the diff viewer. It’s useful when developing a change based on a branch that is not yet committed. In this case, a parent diff of the parent branch would be provided along with the diff of the new commit, and only the new commit will be shown.
It is expected that the client will send the data as part of a
multipart/form-data mimetype. The main diff’s name and
content would be stored in the path
field. If a parent diff is
provided, its name and content would be stored in the
parent_diff_path
field.
An example of this would be:
-- SoMe BoUnDaRy
Content-Disposition: form-data; name=path; filename="foo.diff"
<Unified Diff Content Here>
-- SoMe BoUnDaRy --
Extra data can be stored later lookup. See Storing/Accessing Extra Data for more information.
Request Parameters¶
pathUploaded File | Required The main diff to upload. |
base_commit_idString | The ID/revision this change is built upon. If using a parent diff, then this is the base for that diff. This may not be provided for all diffs or repository types, depending on how the diff was uploaded. Added in 1.7.13 |
basedirString | The base directory that will prepended to all paths in the diff. This is needed for some types of repositories. The directory must be between the root of the repository and the top directory referenced in the diff paths. |
parent_diff_pathUploaded File | The optional parent diff to upload. |
Errors¶
100 - Does Not ExistHTTP 404 - Not Found | Object does not exist |
101 - Permission DeniedHTTP 403 - Forbidden | You don’t have permission for this |
102 - Invalid AttributeHTTP 400 - Bad Request | Invalid attribute |
103 - Not Logged InHTTP 401 - Unauthorized | You are not logged in |
105 - Invalid Form DataHTTP 400 - Bad Request | One or more fields had errors |
112 - OAuth2 Missing Scope ErrorHTTP 403 - Forbidden | Your OAuth2 token lacks the necessary scopes for this request. |
113 - OAuth2 Access Denied ErrorHTTP 403 - Forbidden | OAuth2 token access for this resource is prohibited. |
207 - Repository File Not FoundHTTP 400 - Bad Request | The file was not found in the repository. |
219 - Diff EmptyHTTP 400 - Bad Request | The specified diff file is empty. |
220 - Diff Too BigHTTP 400 - Bad Request | The specified diff file is too large. |
Examples¶
application/vnd.reviewboard.org.diffs+json¶
$ curl http://reviews.example.com/api/review-requests/8/diffs/ -H "Accept: application/json"
Vary: Accept, Cookie
Item-Content-Type: application/vnd.reviewboard.org.diff+json
Content-Type: application/vnd.reviewboard.org.diffs+json
X-Content-Type-Options: nosniff
{
"diffs": [
{
"base_commit_id": null,
"basedir": "",
"extra_data": {},
"id": 8,
"links": {
"files": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/1/files/",
"method": "GET"
},
"repository": {
"href": "http://reviews.example.com/api/repositories/1/",
"method": "GET",
"title": "Review Board SVN"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/1/",
"method": "GET"
},
"update": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/1/",
"method": "PUT"
}
},
"name": "diff",
"revision": 1,
"timestamp": "2009-02-25T02:01:21Z"
},
{
"base_commit_id": null,
"basedir": "",
"extra_data": {},
"id": 11,
"links": {
"files": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/3/files/",
"method": "GET"
},
"repository": {
"href": "http://reviews.example.com/api/repositories/1/",
"method": "GET",
"title": "Review Board SVN"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/3/",
"method": "GET"
},
"update": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/3/",
"method": "PUT"
}
},
"name": "diff",
"revision": 3,
"timestamp": "2009-02-25T21:39:42Z"
}
],
"links": {
"create": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/",
"method": "POST"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/",
"method": "GET"
}
},
"stat": "ok",
"total_results": 2
}