SCM Activity REST API Interface or CLI
GET CHANGE-SETS BY ISSUE KEY
GET http://localhost:8080/rest/scmchangeset/1.0/changeset/activity/list?issueKey={issueKey}
GET http://localhost:8080/rest/scmchangeset/1.0/changeset/activity/tags/list?issueKey={issueKey}
Query Parameters:
- issueKey (String) - JIRA Issue Key e.g. DT-45
- issueId (Number) - Jira Issue ID e.g. 10000
- sort (String) - Default (desc) e.g. desc / asc
- limit (Number) - Default (1000)
Response: [Status: 200]
$ curl -s -u "user:passwd" -XGET \ http://localhost:8080/rest/scmchangeset/1.0/changeset/activity/list/?issueKey=DT-45
GET FIRST OR LAST CHANGE-SET BY ISSUE KEY
GET http://localhost:8080/rest/scmchangeset/1.0/changeset/activity/{issueKey}/first
GET http://localhost:8080/rest/scmchangeset/1.0/changeset/activity/{issueKey}/last
Path Parameters:
- issueKey (String) - JIRA Issue Key e.g. DT-45
Response: [Status: 200]
$ curl -s -u "user:passwd" -XGET \ http://localhost:8080/rest/scmchangeset/1.0/changeset/activity/DT-45/last
GET CHANGE-SET ACTIVITY BY CHANGE TYPE, ISSUE KEY, AND CHANGE ID
GET http://localhost:8080/rest/scmchangeset/1.0/changeset/activity?changeType={changeType}&issueKey={issueKey}&changeId={changeId}
Query Parameters:
- changeType (String) - SCM Change-set Type e.g. perforce
- issueKey (String) - JIRA Issue Key e.g. DT-45
- changeId (String) - SCM Change-set ID
Response: [Status: 200]
$ curl -s -u "user:passwd" -XGET \ http://localhost:8080/rest/scmchangeset/1.0/changeset/activity/?changeType=perforce&issueKey=DT-45&changeId=100
ADD OR POST NEW SCM ACTIVITY
POST http://localhost:8080/rest/scmchangeset/1.0/changeset/activity
Required Schema Field(s):
- issueKey
- changeId
- changeType
- changeAuthor
- changeDate
Response: [Status: 200]
$ curl -s -u "user:passwd" -XPOST -H "Content-Type: application/json" --data '{"issueKey":\ "DT-45","changeId":"100","changeType":"perforce","changeDate":"2016-05-01 00:00:00",\ "changeStatus":"submitted","changeAuthor":"john","changeLink":"http://perforceweb/c=100",\ "changeMessage":"Fixed bug for software X DT-45","changeFiles":[{"fileName":\ "/depot/src/AppEntityManager.java","fileAction":"Modified","fileVersion":"23"}]}' \ http://localhost:8080/rest/scmchangeset/1.0/changeset/activity {"result":1,"message":"[Info] DT-45 > 100 activity row [1] is added."} $
SCM Activity Schema:
{ "issueKey": { "type": "string" }, "changeId": { "type": "string" }, "changeType": { //Preferred format: ChangeType_Repo/Instance Name e.g. p4_engsw "type": "string" }, "changeAuthor": { "type": "string" }, "changeDate": { //UTC date time with format %Y-%m-%d %H:%M:%S "type": "string" }, "changeBranch": { "type": "string" }, "changeTag": { "type": "string" }, "changeTagLink": { "type": "string" }, "changeStatus": { "type": "string" }, "changeLink": { "type": "string" }, "changeMessage": { "type": "string" }, "changeFiles": { "type": "List" }, "changeUpdate": { "type": "boolean" } }
SCM Change Files Schema:
{ "fileName" : { "type": "String" }, "fileAction" : { "type": "String" }, "fileVersion" : { //Optional "type": "String" }, "fileLink" : { "type": "String" } }
POST EXTERNAL JOB LINK
POST http://localhost:8080/rest/scmchangeset/1.0/changeset/joblink
Required Schema Field(s):
- issueKey
- changeId
- changeType
- jobName
- jobStatus
- jobLink
Response: [Status: 200]
$ curl -s -u "user:passwd" -XPOST -H "Content-Type: application/json" --data '{"issueKey":\ "SD-1","changeId":"100","changeType":"perforce","jobName":"test-build#140","jobStatus":"SUCCESS",\ "jobLink":"http://jenkins/job/test-build/140"}' \ http://localhost:8080/rest/scmchangeset/1.0/changeset/joblink {"result":1,"message":"[Info] SD-1 > 100 > test-build#140 joblink is added."} $
Job Schema:
{ "issueKey": { "type": "string" }, "changeId": { "type": "string" }, "changeType": { "type": "string" }, "jobName": { //Unique "type": "string" }, "jobStatus": { "type": "string" }, "jobLink": { "type": "string" }, "jobUpdate": { "type": "boolean" } }
DELETE SCM ACTIVITY BY CHANGE TYPE, ISSUE KEY AND CHANGE ID
DELETE http://localhost:8080/rest/scmchangeset/1.0/changeset/remove/activity?changeType={changeType}&issueKey={issueKey}&changeId={changeId}
DELETE http://localhost:8080/rest/scmchangeset/1.0/changeset/remove/activities?issueKey={issueKey}
Query Parameters:
- changeType (String) - SCM Change-set Type e.g. perforce
- issueKey (String) - JIRA Issue Key e.g. DT-45
- changeId (String) - SCM Change-set ID
Response: [Status: 204]
DELETE SCM ACTIVITY AFFECTED FILE BY CHANGE TYPE, ISSUE KEY, CHANGE ID AND FILE ID
DELETE http://localhost:8080/rest/scmchangeset/1.0/changeset/remove/affected/file?changeType={changeType}&issueKey={issueKey}&changeId={changeId}&fileId={fileId}
DELETE http://localhost:8080/rest/scmchangeset/1.0/changeset/remove/affected/files?changeType={changeType}&issueKey={issueKey}&changeId={changeId}
Query Parameters:
- changeType (String) - SCM Change-set Type e.g. perforce
- issueKey (String) - JIRA Issue Key e.g. DT-45
- changeId (String) - SCM Change-set ID
- fileId (Integer) - File ID e.g. 18
Response: [Status: 204]
DELETE JOB LINK BY CHANGE TYPE, ISSUE KEY, CHANGE ID AND JOB ID
DELETE http://localhost:8080/rest/scmchangeset/1.0/changeset/remove/joblink?changeType={changeType}&issueKey={issueKey}&changeId={changeId}&jobId={jobId}
DELETE http://localhost:8080/rest/scmchangeset/1.0/changeset/remove/joblinks?changeType={changeType}&issueKey={issueKey}&changeId={changeId}
Query Parameters:
- changeType (String) - SCM Change-set Type e.g. perforce
- issueKey (String) - JIRA Issue Key e.g. DT-45
- changeId (String) - SCM Change-set ID
- jobId (Integer) - Job ID e.g. 18
Response: [Status: 204]