Search code examples
gerrit

How to fetch the history messages in gerrit via REST API


enter image description here

How to fetch all the messages in the history section(messages in the image attached) via REST API of Gerrit?


Solution

  • I think you can't get what you want, just the inline comments left in the review.

    For example:

    curl -user USER:PASS --request GERRIT-SERVER/a/changes/CHANGE-NUMBER/comments | sed 1d | jq --raw-output ".[][] | {Updated: .updated, Message: .message}"
    

    Returns:

    {
      "Updated": "2021-03-03 12:58:18.000000000",
      "Message": "MESSAGE-1"
    }
    {
      "Updated": "2021-03-03 14:13:44.000000000",
      "Message": "MESSAGE-2"
    }
    {
      "Updated": "2021-03-03 14:23:05.000000000",
      "Message": "MESSAGE-3"
    }