Deletes an issue. This example deletes the issue having key = "SCRUM-13". A successful delete is indicated by a response status code equal to 204 with an empty response body. This example demonstrates one possible JSON error response (where the response status code was 403).
curl -X DELETE --user jira@example.com:JIRA_API_TOKEN \
--header 'Accept: application/json' \
--url 'https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-13'
load ./chilkat.dll
set rest [new_CkRest]
# URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-13
set bTls 1
set port 443
set bAutoReconnect 1
set success [CkRest_Connect $rest "your-domain.atlassian.net" $port $bTls $bAutoReconnect]
if {[expr $success != 1]} then {
puts "ConnectFailReason: [CkRest_ConnectFailReason $rest]"
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
exit
}
CkRest_SetAuthBasic $rest "jira@example.com" "JIRA_API_TOKEN"
CkRest_AddHeader $rest "Accept" "application/json"
set sbResponseBody [new_CkStringBuilder]
set success [CkRest_FullRequestNoBodySb $rest "DELETE" "/rest/api/2/issue/SCRUM-13" $sbResponseBody]
if {[expr $success != 1]} then {
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
delete_CkStringBuilder $sbResponseBody
exit
}
set respStatusCode [CkRest_ResponseStatusCode $rest]
if {[expr $respStatusCode >= 400]} then {
puts "Response Status Code = $respStatusCode"
puts "Response Header:"
puts [CkRest_responseHeader $rest]
puts "Response Body:"
puts [CkStringBuilder_getAsString $sbResponseBody]
delete_CkRest $rest
delete_CkStringBuilder $sbResponseBody
exit
}
set jsonResponse [new_CkJsonObject]
CkJsonObject_LoadSb $jsonResponse $sbResponseBody
set i 0
set count_i [CkJsonObject_SizeOfArray $jsonResponse "errorMessages"]
while {[expr $i < $count_i]} {
CkJsonObject_put_I $jsonResponse $i
set strVal [CkJsonObject_stringOf $jsonResponse "errorMessages[i]"]
set i [expr $i + 1]
}
delete_CkRest $rest
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jsonResponse
{
"errorMessages": [
"You do not have permission to delete issues in this project."
],
"errors": {}
}