Scm Activity REST API Interface or CLI (Legacy)
Get change-sets by issue key
GET http://localhost:8080/rest/scmactivity/1.0/changeset/activity/{issueKey}
Query Parameters:
issueKey (String) - JIRA Issue Key e.g. DT-45
Response: [Status: 200]
$ curl -s -u "user:passwd" -XGET \
http://localhost:8080/rest/scmactivity/1.0/changeset/activity/DT-45
Get first or last change-set by issue key
GET http://localhost:8080/rest/scmactivity/1.0/changeset/activity/{issueKey}/first
GET http://localhost:8080/rest/scmactivity/1.0/changeset/activity/{issueKey}/last
Query Parameters:
issueKey (String) - JIRA Issue Key e.g. DT-45
Response: [Status: 200]
$ curl -s -u "user:passwd" -XGET \
http://localhost:8080/rest/scmactivity/1.0/changeset/activity/DT-45/last
Get change-set activity by change type, issue key, and change id
GET http://localhost:8080/rest/scmactivity/1.0/changeset/activity/{changeType}/{issueKey}/{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/scmactivity/1.0/changeset/activity/perforce/DT-45/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: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/scmactivity/1.0/changeset/activity
{"result":1,"message":"[Info] DT-45 > 100 activity row [1] is added."}
$
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"
},
"changeStatus": {
"type": "string"
},
"changeLink": {
"type": "string"
},
"changeMessage": {
"type": "string"
},
"changeFiles": {
"type": "List"
},
"changeUpdate": {
"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"
}
}
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"
}
}
Delete SCM Activity by Change Type, issue key and Change Id
DELETE http://localhost:8080/rest/scmactivity/1.0/changeset/activity/unset/by/{changeType}/{issueKey}/{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: 204]
Delete SCM Activity Affected File by change type, issue key, change id and file id
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
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]