Scm Activity REST API Interface or CLI
GET CHANGE-SETS BY ISSUE KEY
GET http://localhost:8080/rest/scmactivity/1.0/changeset/activity/list
GET http://localhost:8080/rest/scmactivity/1.0/changeset/activity/tags/list
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/scmactivity/1.0/changeset/activity/list/?issueKey=DT-45
GET CHANGE-SET ACTIVITY BY CHANGE TYPE, ISSUE KEY, AND CHANGE ID
GET http://localhost:8080/rest/scmactivity/1.0/changeset/activity
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/scmactivity/1.0/changeset/activity/?changeType=perforce&issueKey=DT-45&changeId=100
ADD OR POST NEW SCM ACTIVITY
POST http://localhost:8080/rest/scmactivity/1.0/changeset/activity
Required Schema Field(s):
- issueKey
- changeId
- changeType
- changeAuthor
- changeDate
Response: [Status: 200]
$ curl -s -u user -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 ToolsX. Ref: DT-51","changeFiles":[{"fileName":\ "/depot/src/AppEntityManager.java","fileAction":"Modified","fileVersion":"23"}],"changeTag":\ "R1.0","changeTagLink":"#"}' http://localhost:8080/rest/scmactivity/1.0/changeset/activity Enter host password for user 'user': {"result":1,"message":"[Info] DT-51 > 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" }, "notifyEmail": { "type": "boolean" }, "notifyAs": { "type": "string" } }
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/scmactivity/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/scmactivity/1.0/changeset/joblink {"result":1,"message":"[Info] SD-1 > 100 > test-build#140 joblink is added."} $
Schema:
{ "issueKey": { "type": "string" }, "changeId": { "type": "string" }, "changeType": { "type": "string" }, "jobName": { //Unique "type": "string" }, "jobStatus": { "type": "string" }, "jobLink": { "type": "string" }, "jobUpdate": { "type": "boolean" }, "notifyEmail": { "type": "boolean" }, "notifyAs": { "type": "string" } }
UPDATE SCM ACTIVITY MESSAGE
POST http://localhost:8080/rest/scmactivity/1.0/changeset/activity/message
Required Schema Field(s):
- issueKey
- changeId
- changeType
- changeMessage
Response: [Status: 200]
$ curl -s -u "user:passwd" -XPOST -H "Content-Type: application/json" --data '{"issueKey":\ "SD-1","changeId":"100","changeType":"perforce","changeMessage":\ "Fixed bug for software X. jira:SD-1"}' \ http://localhost:8080/rest/scmactivity/1.0/changeset/activity/message {"result":1,"message":"[Info] SD-1 > 100 activity message row [1] is updated."} $
Schema:
{ "issueKey": { "type": "string" }, "changeId": { "type": "string" }, "changeType": { "type": "string" }, "changeMessage": { "type": "string" } }
UPDATE SCM ACTIVITY AFFECTED/CHANGE FILES
POST http://localhost:8080/rest/scmactivity/1.0/changeset/activity/files
Required Schema Field(s):
- issueKey
- changeId
- changeType
- changeFiles
Response: [Status: 200]
$ curl -s -u "user:passwd" -XPOST -H "Content-Type: application/json" --data '{"issueKey":\ "DT-45","changeId":"100","changeType":"perforce","changeFiles":[{"fileName":\ "/depot/src/AppEntityManager.java","fileAction":"Modified","fileVersion":"23"},{"fileName":\ "/depot/src/Test.java","fileAction":"Added","fileVersion":"1"}]}' \ http://localhost:8080/rest/scmactivity/1.0/changeset/activity/files {"result":1,"message":"[Info] DT-45 > 100 activity change files row [1] is updated."} $
Schema:
{ "issueKey": { "type": "string" }, "changeId": { "type": "string" }, "changeType": { "type": "string" }, "changeFiles": { "type": "List" } }
Change Files List Item:
{ "fileName" : { "type": "String" }, "fileAction" : { "type": "String" }, "fileVersion" : { //Optional "type": "String" }, "fileLink" : { "type": "String" } }
DELETE SCM ACTIVITY BY CHANGE TYPE, ISSUE KEY AND CHANGE ID
DELETE http://localhost:8080/rest/scmactivity/1.0/changeset/remove/activity
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]
$ curl -u superadmin -XDELETE "http://localhost:8080/rest/scmactivity/1.0/changeset/remove/activity/?\ issueKey=ST-1&changeType=Github/scmenthusiast/test&changeId=6df95ec2e446f1797b0e2f9820d3db662bd39182" $
DELETE SCM ACTIVITY AFFECTED FILE BY CHANGE TYPE, ISSUE KEY, CHANGE ID AND FILE ID
DELETE http://localhost:8080/rest/scmactivity/1.0/changeset/remove/affected/file
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 (Number) - File ID e.g. 18
Response: [Status: 204]
$ curl -u superadmin -XDELETE "http://localhost:8080/rest/scmactivity/1.0/changeset/remove/affected/file/?\ issueKey=ST-1&changeType=Github/scmenthusiast/test&changeId=6df95ec2e446f1797be2f9820d3db662bd39182&fileId=18" {"id":1,"message":"[Info] Deleted SCM File > ST-1 > File ID > 18"} $
DELETE JOB LINK BY CHANGE TYPE, ISSUE KEY, CHANGE ID AND JOB ID
DELETE http://localhost:8080/rest/scmactivity/1.0/changeset/remove/joblink
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 (Number) - Job ID e.g. 18
Response: [Status: 204]