Hooks & APIs

Commits

 

Call the Get Commits API to obtain commit information associated with an issue.

Get Commits REST API
url
/rest/gitplugin/1.0/issues/{issueKey}/commits
method
GET
parameters
issuekey
Required.  Jira issue key
Example:  TST-234

 

Example:
http://jira.yourorg.com/rest/gitplugin/1.0/issues/TST-234/commits

Returns the following example result:

{
  "commits":[
    {
    "author": "msmith ",
    "commitId": "34efa20372f0e2f0c9b705aacc57d7ad82e01426",
    "date": "2015-05-18T10:52:54.000+0000",
    "message": "TST-234 Update link in documentation"
    "notes": {
        "refs/notes/commits": "TST-1 fixed also"
      },
    },
    {
    "author": "msmith ",
    "commitId": "52696c2d963be8986c7a2444b6473ea785632dce",
    "date": "2015-05-18T17:41:58.000+0000",
    "message": "TST-234 Remove libtiff dependency"
    }
  ]
}
showFiles Commits REST API
url
/rest/gitplugin/1.0/issues/{issueKey}/commits{?showFiles=[true|false]}

Extend the Commits API to review which files changed related to a specific JIRA issue by adding ?showfiles=[true|false] as an optional parameter.
method
GET
parameters
issuekey
Required.  Jira issue key
Example:  TST-123

 

Example:
Usage:
http://jira.yourorg.com/jira/rest/gitplugin/1.0/issues/TST-123/commits?showFiles=true

Returns the following example result, if showFiles=true:

{
  "commits": [
    {
      "author": "msmith ",
      "commitId": "257b4a8490270014922f3b821d61c86e76166dd9",
      "date": "2015-12-07 10:54:56 +0600",
      "message": "message with TST-123",
      "notes": {
        "refs/notes/commits": "TST-1 fixed also"
      },
      "files": [
        {
          "path": "testFile2.txt",
          "linesAdded": 1,
          "linesChanged": 0,
          "linesDeleted": 0,
          "added": true,
          "deleted": false,
        }
      ]
    }
  ]
}