Jump to >

Validate Diff Commit List Resource

Added in 4.0

Verifies whether or not a diff file for a commit will work.

This allows clients to validate whether or not diff files for commits can be parsed and displayed without actually creating a review request first.

Important

Using this resource requires extra features to be enabled on the server. See “Required Features” below.

Details

Name commit_validation
URI /api/validation/commits/
Required Features
  • diffviewer.dvcs
Token Policy ID commit_validation
HTTP Methods
  • GET - Return links for using this resource.
  • POST - Validate a diff for a commit.
Parent Resource Validation List Resource
Child Resources None
Anonymous Access Yes, if anonymous site access is enabled

Fields

validation_infoString Validation metdata to pass to this resource to help validate the next commit.

HTTP GET

Return 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 for a commit.

This API has a similar signature to the Draft DiffCommit resource POST API, but instead of actually creating commits, it will return a result representing whether or not the included diff file parsed and validated correctly.

This API must be called before posting to the Draft DiffCommit resource because the validation_info field returned by this resource is required for posting to that resource.

Request Parameters

commit_idString Required

The ID of the commit being validated.

diffUploaded file Required

The diff file to validate.

parent_idString Required

The ID of the parent commit.

repositoryString Required

The path or ID of the repository.

base_commit_idString The base commit ID.
parent_diffUploaded file The parent diff of the commit being validated.
validation_infoString

Validation metadata from a previous call to this API.

This field is required for all but the first commit in a series.

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.
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.commit-validation+json

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