Jump to >

This documentation covers the in-development release of Review Board. You can see the latest stable docs or all previous versions.

Draft Diff Commit List Resource

Added in 4.0

Provides information on pending draft commits for a review request.

POSTing to this resource will update a review request draft with the provided diff.

Important

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

Details

Name draft_commits
URI /api/review-requests/{review_request_id}/draft/diffs/{diff_revision}/draft-commits/
Required Features
  • diffviewer.dvcs
Token Policy ID draft_commit
HTTP Methods
  • GET - Return the list of commits.
  • POST - Create a new commit.
Parent Resource Draft Diff Resource
Child Resources
Anonymous Access No

HTTP GET

Return the list of commits.

Request Parameters

counts-onlyBoolean If specified, a single count field is returned with the number of results, instead of the results themselves.
max-resultsInteger The maximum number of results to return in this list. By default, this is 25. There is a hard limit of 200; if you need more than 200 results, you will need to make more than one request, using the “next” pagination link.
startInteger 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.

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
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

Create a new commit.

A draft must exist and the review request must be created with history support in order to post to this resource.

Request Parameters

author_dateISO 8601 Date/Time Required

The date and time this commit was authored in ISO 8601 format (YYYY-MM-DD HH:MM:SS+ZZZZ).

author_emailString Required

The e-mail address of the author of this commit.

author_nameString Required

The name of the author of this commit.

commit_idString Required

The ID of this commit.

commit_messageString Required

The commit message.

diffUploaded file Required

The corresponding diff for this commit.

committer_dateString

The date and time this commit was committed in ISO 8601 format (YYYY-MM-DD HH:MM:SS+ZZZZ).

If this field is specified, the “committer_name” and “committer_email” fields must also be specified.

committer_emailString

The e-mail address of the committer of this commit.

If this field is specified, the “committer_name” and “committer_date” fields must also be specified.

committer_nameString

The name of the the committer of this commit, if applicable.

If this field is specified, the “committer_date” and “committer_email” fields must also be specified.

parent_diffUploaded file The optional parent diff to upload.
validation_infoString

Validation metadata from the DiffCommit validation resource.

This is required for all but the first commit.

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.draft-commits+json

$ curl http://reviews.example.com/api10/3/ -H "Accept: application/json"
Vary: Accept, Cookie
Item-Content-Type: application/vnd.reviewboard.org.draft-commit+json
Content-Type: application/vnd.reviewboard.org.draft-commits+json
ETag: 8f8beff8b390c61365380a700e0d4ea6666e0d9c
X-Content-Type-Options: nosniff
{
  "draft_commits": [
    {
      "author_date": "2011-03-05T19:46:54-06:00", 
      "author_email": "sws587@mail.usask.ca", 
      "author_name": "Steve Sutcliffe", 
      "commit_id": "224589cf334e9baafeac1165be5e5c04991fd65e", 
      "commit_message": "modified tests\n", 
      "committer_date": "2011-03-05T19:46:54-06:00", 
      "committer_email": "sws587@mail.usask.ca", 
      "committer_name": "Steve Sutcliffe", 
      "extra_data": {}, 
      "filename": "diff", 
      "id": 4, 
      "links": {
        "draft_files": {
          "href": "http://reviews.example.com/api/review-requests/10/draft/diffs/3/files/?commit-id=224589cf334e9baafeac1165be5e5c04991fd65e", 
          "method": "GET"
        }, 
        "self": {
          "href": "http://reviews.example.com/api/review-requests/10/draft/diffs/3/draft-commits/224589cf334e9baafeac1165be5e5c04991fd65e/", 
          "method": "GET"
        }, 
        "update": {
          "href": "http://reviews.example.com/api/review-requests/10/draft/diffs/3/draft-commits/224589cf334e9baafeac1165be5e5c04991fd65e/", 
          "method": "PUT"
        }
      }, 
      "parent_id": "e76c016e09c415d7afc4c004a8a290b3c51bff59"
    }
  ], 
  "links": {
    "create": {
      "href": "http://reviews.example.com/api10/3/", 
      "method": "POST"
    }, 
    "self": {
      "href": "http://reviews.example.com/api10/3/", 
      "method": "GET"
    }
  }, 
  "stat": "ok", 
  "total_results": 1
}