Validate Diff List Resource¶
Added in 2.0
Verifies whether a diff file will work.
This allows clients to validate whether a diff file (with optional parent diff) can be parsed and displayed, without actually creating a review request first.
Details¶
Name | diff_validation |
URI | /api/validation/diffs/ |
Token Policy ID | diff_validation |
HTTP Methods | |
Parent Resource | |
Child Resources | None |
Fields¶
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. Added in 1.7 |
commit_countInteger | The number of commits present in the case of review requests created with commit history. Added in 4.0 |
extra_dataDictionary | Extra data as part of the diff. This can be set by the API or extensions. Added in 2.0 |
idInteger | The numeric ID of the diff. |
nameString | The name of the diff, usually the filename. |
repositoryRepository Resource | The repository that the diff is applied against. |
revisionInteger | The revision of the diff. Starts at 1 for public diffs. Draft diffs may be at 0. |
timestamp | The date and time that the diff was uploaded. |
Links¶
Name |
Method |
Resource |
---|---|---|
create | POST |
|
self | GET |
HTTP GET¶
Returns links for using this resource.
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¶
Validate a diff.
This API has a similar signature to the ReviewRequest resource POST API, but instead of actually creating a review request, will return either OK or an error, depending on whether the included diff file parsed correctly.
Request Parameters¶
pathUploaded file | Required The main diff file. |
repositoryString | Required The path or ID of the repository. |
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. |
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¶
Examples¶
application/vnd.reviewboard.org.diff-validation+json¶
$ curl https://reviews.example.com/api/validation/diffs/ -H "Accept: application/json"
HTTP 200 OK
Content-Length: 204
Content-Type: application/vnd.reviewboard.org.diff-validation+json
ETag: 3c03e52b74941c449ab0558f34e821f996fad91f
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
{
"links": {
"create": {
"href": "https://reviews.example.com/api/validation/diffs/",
"method": "POST"
},
"self": {
"href": "https://reviews.example.com/api/validation/diffs/",
"method": "GET"
}
},
"stat": "ok"
}