Can you list Gerrit reviews from a Jirra issue through the Jira REST API

Eric Windfelder September 19, 2016

Hello,

We have the "Gerrit Code Review for Jira" plugin installed and configured. The plugin is working, I can see the related Gerrit reviews listed in the Jirra issue through the UI. 

Is there a way to see the related Gerrit reviews through the JIRA REST api?

example: curl -u admin:admin http://localhost:8090/jira/rest/api/2/issue/MKY-1

Eric

1 answer

1 accepted

0 votes
Answer accepted
Petar Petrov (Appfire)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 20, 2016

You can't get them via REST from JIRA - the Gerrit reviews are rendered as a web panel which does not use REST to get the data.

You have several options, depending on access restrictions and how proficient you are in coding:

  1. Call directly the Gerrit REST API, making the same query as the one executed by the Gerrit plugin for JIRA. The plugin is open source, so you can take a look at the code.
  2. Contribute a REST endpoint to the plugin code
  3. If you use Script Runner, you can write a script to invoke the Gerrit plugin manager which returns this data (com.meetme.plugins.jira.gerrit.data.IssueReviewsManager). However, this service is not currently public, so you'll need to contribute a change to its source code to make it public. This script can then be exposed as REST in Script Runner.

If you have sufficient access, the easiest way will be option 1.

 

 

 

Suggest an answer

Log in or Sign up to answer