Edits the issue from a JSON representation. This example updates the issue having key = "SCRUM-15". A successful update is indicated by a response status code equal to 204 with an empty response body.
curl -X PUT --user jira@example.com:JIRA_API_TOKEN \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"update": {
"summary": [
{
"set": "Bug in business logic"
}
],
"labels": [
{
"add": "triaged"
},
{
"remove": "blocker"
}
]
},
"fields": {
"customfield_10010": 1
},
"historyMetadata": {
"type": "myplugin:type",
"description": "text description",
"descriptionKey": "plugin.changereason.i18.key",
"activityDescription": "text description",
"activityDescriptionKey": "plugin.activity.i18.key",
"actor": {
"id": "tony",
"displayName": "Tony",
"type": "mysystem-user",
"avatarUrl": "http://mysystem/avatar/tony.jpg",
"url": "http://mysystem/users/tony"
},
"generator": {
"id": "mysystem-1",
"type": "mysystem-application"
},
"cause": {
"id": "myevent",
"type": "mysystem-event"
},
"extraData": {
"keyvalue": "extra data",
"goes": "here"
}
},
"properties": [
{
"key": "key1",
"value": "can be set at issue create or update time"
},
{
"key": "key2",
"value": "and there can be multiple properties"
}
]
}' \
--url 'https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15'
LOCAL loRest
LOCAL lnSuccess
LOCAL lnBTls
LOCAL lnPort
LOCAL lnBAutoReconnect
LOCAL loJson
LOCAL loSbRequestBody
LOCAL loSbResponseBody
LOCAL lnRespStatusCode
loRest = CreateObject('Chilkat_9_5_0.Rest')
* URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15
lnBTls = 1
lnPort = 443
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("your-domain.atlassian.net",lnPort,lnBTls,lnBAutoReconnect)
IF (lnSuccess <> 1) THEN
? "ConnectFailReason: " + STR(loRest.ConnectFailReason)
? loRest.LastErrorText
RELEASE loRest
CANCEL
ENDIF
loRest.SetAuthBasic("jira@example.com","JIRA_API_TOKEN")
loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.UpdateString("update.summary[0].set","Bug in business logic")
loJson.UpdateString("update.labels[0].add","triaged")
loJson.UpdateString("update.labels[1].remove","blocker")
loJson.UpdateNumber("fields.customfield_10010","1")
loJson.UpdateString("historyMetadata.type","myplugin:type")
loJson.UpdateString("historyMetadata.description","text description")
loJson.UpdateString("historyMetadata.descriptionKey","plugin.changereason.i18.key")
loJson.UpdateString("historyMetadata.activityDescription","text description")
loJson.UpdateString("historyMetadata.activityDescriptionKey","plugin.activity.i18.key")
loJson.UpdateString("historyMetadata.actor.id","tony")
loJson.UpdateString("historyMetadata.actor.displayName","Tony")
loJson.UpdateString("historyMetadata.actor.type","mysystem-user")
loJson.UpdateString("historyMetadata.actor.avatarUrl","http://mysystem/avatar/tony.jpg")
loJson.UpdateString("historyMetadata.actor.url","http://mysystem/users/tony")
loJson.UpdateString("historyMetadata.generator.id","mysystem-1")
loJson.UpdateString("historyMetadata.generator.type","mysystem-application")
loJson.UpdateString("historyMetadata.cause.id","myevent")
loJson.UpdateString("historyMetadata.cause.type","mysystem-event")
loJson.UpdateString("historyMetadata.extraData.keyvalue","extra data")
loJson.UpdateString("historyMetadata.extraData.goes","here")
loJson.UpdateString("properties[0].key","key1")
loJson.UpdateString("properties[0].value","can be set at issue create or update time")
loJson.UpdateString("properties[1].key","key2")
loJson.UpdateString("properties[1].value","and there can be multiple properties")
loRest.AddHeader("Content-Type","application/json")
loRest.AddHeader("Accept","application/json")
loSbRequestBody = CreateObject('Chilkat_9_5_0.StringBuilder')
loJson.EmitSb(loSbRequestBody)
loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestSb("PUT","/rest/api/2/issue/SCRUM-15",loSbRequestBody,loSbResponseBody)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
CANCEL
ENDIF
lnRespStatusCode = loRest.ResponseStatusCode
IF (lnRespStatusCode >= 400) THEN
? "Response Status Code = " + STR(lnRespStatusCode)
? "Response Header:"
? loRest.ResponseHeader
? "Response Body:"
? loSbResponseBody.GetAsString()
RELEASE loRest
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
CANCEL
ENDIF
RELEASE loRest
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody