Jump to >

This documentation covers Review Board 2.0. You can see the latest Review Board documentation or all other versions.

Validate Diff List Resource

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/
HTTP Methods
  • GET - Returns links for using this resource.
  • POST - Validate a diff.
Parent Resource Validation List Resource
Child Resources None
Anonymous Access Yes, if anonymous site access is enabled

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.
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.
extra_dataDictionary Extra data as part of the diff. This can be set by the API or extensions.
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.
timestampString The date and time that the diff was uploaded (in YYYY-MM-DD HH:MM:SS format).

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

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

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
105 - Invalid Form DataHTTP 400 - Bad Request One or more fields had errors
206 - Invalid RepositoryHTTP 400 - Bad Request The repository path specified is not in the list of known repositories.
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.
224 - Diff Parse ErrorHTTP 400 - Bad Request The specified diff file could not be parsed.

Examples

application/vnd.reviewboard.org.diff-validation+json

$ curl http://reviews.example.com/api/validation/diffs/ -H "Accept: application/json"
Vary: Accept, Cookie
Content-Type: application/vnd.reviewboard.org.diff-validation+json
X-Content-Type-Options: nosniff
{
  "links": {
    "create": {
      "href": "http://reviews.example.com/api/validation/diffs/", 
      "method": "POST"
    }, 
    "self": {
      "href": "http://reviews.example.com/api/validation/diffs/", 
      "method": "GET"
    }
  }, 
  "stat": "ok"
}