Xojo Plugin Jira - Issues: Delete an Issue

Back to Index

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).

Documentation: https://developers.atlassian.com/cloud/jira/platform/rest/#api-api-2-issue-issueIdOrKey-delete

CURL Command

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'

Xojo Plugin Example

Dim rest As New Chilkat.Rest
Dim success As Boolean

//  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-13
Dim bTls As Boolean
bTls = True
Dim port As Int32
port = 443
Dim bAutoReconnect As Boolean
bAutoReconnect = True
success = rest.Connect("your-domain.atlassian.net",port,bTls,bAutoReconnect)
If (success <> True) Then
    System.DebugLog("ConnectFailReason: " + Str(rest.ConnectFailReason))
    System.DebugLog(rest.LastErrorText)
    Return
End If

rest.SetAuthBasic("jira@example.com","JIRA_API_TOKEN")

rest.AddHeader("Accept","application/json")

Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestNoBodySb("DELETE","/rest/api/2/issue/SCRUM-13",sbResponseBody)
If (success <> True) Then
    System.DebugLog(rest.LastErrorText)
    Return
End If

Dim respStatusCode As Int32
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
    System.DebugLog("Response Status Code = " + Str(respStatusCode))
    System.DebugLog("Response Header:")
    System.DebugLog(rest.ResponseHeader)
    System.DebugLog("Response Body:")
    System.DebugLog(sbResponseBody.GetAsString())
    Return
End If

Dim jsonResponse As New Chilkat.JsonObject
jsonResponse.LoadSb(sbResponseBody)

Dim i As Int32
Dim count_i As Int32
Dim strVal As String

i = 0
count_i = jsonResponse.SizeOfArray("errorMessages")
While i < count_i
    jsonResponse.I = i
    strVal = jsonResponse.StringOf("errorMessages[i]")
    i = i + 1
Wend

Sample JSON Response Body

{
  "errorMessages": [
    "You do not have permission to delete issues in this project."
  ],
  "errors": {}
}