Marek Bocian
Marek Bocian

Reputation: 135

Gerrit API - get CommitInfo with optional WEB_LINKS - query syntax

I would like to create a REST query for Gerrit that would return CommitInfo entity but with a optional field containing so-called WEB_LINKS, that is "links to the commit in external sites as a list of WebLinkInfo entities."

This is how the query looks for obtaining the 'standard' CommitIinfo request (works correct): https://<GERRIT_HOST>/a/projects/<PROJECT_NAME>/commits/<COMMIT_SHA>

According to the documentation ( 1. https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info 2. https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info )

I've written this:
https://<GERRIT_HOST>/a/projects/<PROJECT_NAME>/commits/<COMMIT_SHA>/?o=CURRENT_COMMIT&o=WEB_LINKS but I am getting Er=400 Client Error...

Could you please provide the corrent syntax of the query? In advance, thank you!

Upvotes: 1

Views: 327

Answers (1)

To get the WEB_LINKS info, the correct would be to add "?links" at the end of the command but I think this feature isn't available in project "Get Commit" endpoint.

But...

I was able to get this information using the change "Get Commit" endpoint using:

https://<GERRIT_HOST>/a/changes/<CHANGE_ID>/revisions/<COMMIT_SHA>/commit?links

Like for example:

https://<GERRIT_HOST>/a/changes/71135/revisions/c0d5d23ea05bf6e2011b453f1ee8c47a4da60821/commit?links

Upvotes: 1

Related Questions