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'
integer li_rc
oleobject loo_Rest
integer li_Success
integer li_BTls
integer li_Port
integer li_BAutoReconnect
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_SbResponseBody
integer li_RespStatusCode
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
// URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("your-domain.atlassian.net",li_Port,li_BTls,li_BAutoReconnect)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
return
end if
loo_Rest.SetAuthBasic("jira@example.com","JIRA_API_TOKEN")
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_Json.UpdateString("update.summary[0].set","Bug in business logic")
loo_Json.UpdateString("update.labels[0].add","triaged")
loo_Json.UpdateString("update.labels[1].remove","blocker")
loo_Json.UpdateNumber("fields.customfield_10010","1")
loo_Json.UpdateString("historyMetadata.type","myplugin:type")
loo_Json.UpdateString("historyMetadata.description","text description")
loo_Json.UpdateString("historyMetadata.descriptionKey","plugin.changereason.i18.key")
loo_Json.UpdateString("historyMetadata.activityDescription","text description")
loo_Json.UpdateString("historyMetadata.activityDescriptionKey","plugin.activity.i18.key")
loo_Json.UpdateString("historyMetadata.actor.id","tony")
loo_Json.UpdateString("historyMetadata.actor.displayName","Tony")
loo_Json.UpdateString("historyMetadata.actor.type","mysystem-user")
loo_Json.UpdateString("historyMetadata.actor.avatarUrl","http://mysystem/avatar/tony.jpg")
loo_Json.UpdateString("historyMetadata.actor.url","http://mysystem/users/tony")
loo_Json.UpdateString("historyMetadata.generator.id","mysystem-1")
loo_Json.UpdateString("historyMetadata.generator.type","mysystem-application")
loo_Json.UpdateString("historyMetadata.cause.id","myevent")
loo_Json.UpdateString("historyMetadata.cause.type","mysystem-event")
loo_Json.UpdateString("historyMetadata.extraData.keyvalue","extra data")
loo_Json.UpdateString("historyMetadata.extraData.goes","here")
loo_Json.UpdateString("properties[0].key","key1")
loo_Json.UpdateString("properties[0].value","can be set at issue create or update time")
loo_Json.UpdateString("properties[1].key","key2")
loo_Json.UpdateString("properties[1].value","and there can be multiple properties")
loo_Rest.AddHeader("Content-Type","application/json")
loo_Rest.AddHeader("Accept","application/json")
loo_SbRequestBody = create oleobject
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Rest.FullRequestSb("PUT","/rest/api/2/issue/SCRUM-15",loo_SbRequestBody,loo_SbResponseBody)
if li_Success <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
li_RespStatusCode = loo_Rest.ResponseStatusCode
if li_RespStatusCode >= 400 then
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
Write-Debug "Response Header:"
Write-Debug loo_Rest.ResponseHeader
Write-Debug "Response Body:"
Write-Debug loo_SbResponseBody.GetAsString()
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody