@PLUGIN@ - /changes/ REST API

This page describes the ‘/changes/’ REST endpoints that are added by the @PLUGIN@ plugin.

Please also take note of the general information on the REST API.

@PLUGIN@ Endpoints

Get Verifications

GET /changes/{change-id}/revisions/{revision-id}/@PLUGIN@~verifications

Gets the verifications for a change. Please refer to the general changes rest api for additional info on this request.

Request

  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/verifications HTTP/1.0

Response

  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "gate-horizon-pep8": {
      "url": "https://ci.host.com/jobs/gate-horizon-pep8/1711",
      "value": 1,
      "verifier": "Jenkins",
      "comment": "Non Voting",
      "granted": "15 Mar 2016 08:10:41"
    },
    "gate-horizon-python27": {
      "url": "https://ci.host.com/jobs/gate-horizon-python27/1711",
      "value": 1,
      "verifier": "Jenkins",
      "comment": "Passed",
      "granted": "15 Mar 2016 08:30:16"
    }
    "gate-horizon-python34": {
      "url": "https://ci.host.com/jobs/gate-horizon-python34/1711",
      "value": -1,
      "verifier": "Jenkins",
      "comment": "Failed",
      "granted": "15 Mar 2016 08:40:23"
    }
  }

Post Verify

POST /changes/{change-id}/revisions/{revision-id}/@PLUGIN@~verifications

Posts a verification result to a patchset.

The verification must be provided in the request body as a VerifyInput entity.

Request

  POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/verify-status~verifications HTTP/1.0
  Content-Type: application/json;charset=UTF-8

Example

Post two verification results to patchset revision 14a95001c. Notice two levels of quoting are required, one for the local shell, and another for the argument parser inside the Gerrit server.

curl -X POST --digest --user joe:secret --data-binary
@verification_data.txt --header "Content-Type: application/json; charset=UTF-8"
http://localhost:8080/a/changes/1000/revisions/14a95001c/verify-status~verifications

$ cat verification_data.txt
{
  "verifications": {
    "gate-horizon-python27": {
      "url": "https://ci.host.com/jobs/gate-horizon-python27/1711",
      "value": 1,
      "verifier": "Jenkins",
      "comment": "Passed"
    },
    "gate-horizon-python34": {
      "url": "https://ci.host.com/jobs/gate-horizon-python34/1711",
      "value": -1,
      "verifier": "Jenkins",
      "comment": "Failed"
    }
  }
}

JSON Entities

VerifyInput

The VerifyInput entity contains information for adding a verification to a revision.

Field NameDescription
categoryrequiredThe name of the category to be added as a verification
valuerequiredThe value associated with the category
commentoptionalThe comment associated with the category
urloptionalThe url associated with the category
verifieroptionalThe user that verified the revision

RevisionInfo

The RevisionInfo entity contains information about a patch set. Not all fields are returned by default. Additional fields can be obtained by adding o parameters as described in Query Changes

Field NameDescription
verificationsoptionalThe verifications on the patchset as a list of VerificationInfo entities

VerificationInfo

The VerificationInfo entity describes a verification on a patch set.

Field NameDescription
commentA short comment about about this verification
urlThe URL for this verification
valueThe value for this verification
verifierThe user that reported this verification

SEE ALSO

GERRIT

Part of Gerrit Code Review