@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

  )]}'
  {
    "check-horizon-pep8": {
      "url": "https://ci.host.com/jobs/gate-horizon-pep8/1711",
      "value": 1,
      "reporter": "Jenkins CI",
      "comment": "Experimental",
      "granted": "15 Mar 2016 08:10:41",
      "category": "check",
      "duration": "1m 30s"
    },
    "gate-horizon-python27": {
      "url": "https://ci.host.com/jobs/gate-horizon-python27/1711",
      "value": 1,
      "abstain": true,
      "reporter": "Acme CI",
      "comment": "Informational only",
      "granted": "15 Mar 2016 08:30:16"
      "category": "gate",
      "duration": "2m 40s",
    }
    "gate-horizon-python34": {
      "url": "https://ci.host.com/jobs/gate-horizon-python34/1711",
      "value": -1,
      "reporter": "Drone CI",
      "comment": "RuntimeError: File was not found",
      "granted": "15 Mar 2016 08:40:23",
      "category": "gate",
      "duration": "12m 20s"
    }
  }

Post Verify

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

Posts a verification result to a patchset. Results can be updated by posting with the same job name.

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,
      "abstain": true,
      "reporter": "Acme CI",
      "comment": "Informational only",
      "category": "gate",
      "duration": "2m 40s"
    },
    "gate-horizon-python34": {
      "url": "https://ci.host.com/jobs/gate-horizon-python34/1711",
      "value": -1,
      "abstain": false,
      "reporter": "Drone CI",
      "comment": "RuntimeError: File was not found",
      "category": "gate",
      "duration": "12m 20s"
    }
  }
}

JSON Entities

VerifyInput

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

Field NameDescription
valuerequiredThe pass/fail result for this job
abstainoptionalWhether the value counts as a vote (defaults to false)
commentoptionalA short comment about this job
urloptionalThe url link to more info about this job
reporteroptionalThe user that verified this job
categoryoptionalA category for this job
durationoptionalThe time it took to run this job

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
valueThe pass/fail result for this job
abstainWhether the value counts as a vote
commentA short comment about this job
urlThe url link to more info about this job
reporterThe user that verified this job
categoryA category for this job
durationThe time it took to run this job
grantedThe date this verification was recorded

SEE ALSO

GERRIT

Part of Gerrit Code Review