Gerrit API

142 views
Skip to first unread message

Steffen Gebert

unread,
Jun 29, 2011, 4:20:03 PM6/29/11
to Repo and Gerrit Discussion
Hi,

is there an API, e.g. accessible via REST, by which you can get out some data about the authors / reviewers of patches out of Gerrit? The user interface communicates with the server in REST, but is it kind of stable and could be used outside of the GWT interface?

Is there a way except direct database access?

I'm thinking of querying per issue per patch set and getting the review data.

Has sb. implemented some stats tool about most active reviewers etc?

Thanks for your reply.

Kind regards
--
Steffen Gebert
TYPO3 v4 Core Team Member

TYPO3 .... inspiring people to share!
Get involved: http://typo3.org

Magnus Bäck

unread,
Jun 29, 2011, 4:24:56 PM6/29/11
to Repo and Gerrit Discussion
On Wednesday, June 29, 2011 at 22:20 CEST,
Steffen Gebert <ste...@steffen-gebert.de> wrote:

> is there an API, e.g. accessible via REST, by which you can get out
> some data about the authors / reviewers of patches out of Gerrit? The
> user interface communicates with the server in REST, but is it kind of
> stable and could be used outside of the GWT interface?

Hmm, I don't think so.

> Is there a way except direct database access?
>
> I'm thinking of querying per issue per patch set and getting the
> review data.
>
> Has sb. implemented some stats tool about most active reviewers etc?

Take a look at the "query" SSH command.

--
Magnus Bäck Opinions are my own and do not necessarily
SW Configuration Manager represent the ones of my employer, etc.
Sony Ericsson

Conley Owens

unread,
Jun 29, 2011, 4:48:28 PM6/29/11
to Repo and Gerrit Discussion
http://gerrit.googlecode.com/svn/documentation/2.2.0/cmd-query.html

ssh -p 29418 us...@review.example.com gerrit \
query --all-approvals --format=JSON myproject status:open | \
head -n -1 | script_that_can_read_the_json

> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en
>

Peter Jönsson P

unread,
Jun 30, 2011, 5:09:26 AM6/30/11
to Conley Owens, Repo and Gerrit Discussion
Hi!

Any plans on making this available through HTTP? It's no problem using the ssh-connection but HTTP would be nice :)

// peter

Shawn Pearce

unread,
Jun 30, 2011, 10:01:29 AM6/30/11
to Peter Jönsson P, Conley Owens, Repo and Gerrit Discussion
On Thu, Jun 30, 2011 at 02:09, Peter Jönsson P
<peter.p...@ericsson.com> wrote:
> Any plans on making this available through HTTP? It's no problem using the ssh-connection but HTTP would be nice :)
>
> -----Original Message-----
> From: repo-d...@googlegroups.com [mailto:repo-d...@googlegroups.com] On Behalf Of Conley Owens
> Sent: den 29 juni 2011 22:48
> To: Repo and Gerrit Discussion
> Subject: Re: Gerrit API
>
> http://gerrit.googlecode.com/svn/documentation/2.2.0/cmd-query.html
>
> ssh -p 29418 us...@review.example.com gerrit \
>  query --all-approvals --format=JSON myproject status:open | \
>  head -n -1 | script_that_can_read_the_json

Query is available over HTTP in a more standardized format than what
the web UI uses:

http://review.example.com/query?q=status:open+project:tools/gerrit.git

This produces JSON, in the same format as the SSH query command. Its
the same backend code, the only difference is the parameter parsing. I
can't remember if there is an HTTP query parameter to match to the
options like --all-approvals from SSH. If not it would be trivial to
add, the SSH command is just poking those values down to the backend
code. The HTTP code would just need to do the same thing.

I wouldn't try to use any other JSON interface over HTTP for
integration. The interfaces the web UI uses are considered private and
get modified all of the time. Gerrit 2.2.x uses some pretty different
structures from 2.1.x and we don't promise to retain compatibility.

Reply all
Reply to author
Forward
0 new messages