Visual Basic 6.0 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'

Visual Basic 6.0 Example

Dim rest As New ChilkatRest
Dim success As Long

'  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-13
Dim bTls As Long
bTls = 1
Dim port As Long
port = 443
Dim bAutoReconnect As Long
bAutoReconnect = 1
success = rest.Connect("your-domain.atlassian.net",port,bTls,bAutoReconnect)
If (success <> 1) Then
    Debug.Print "ConnectFailReason: " & rest.ConnectFailReason
    Debug.Print rest.LastErrorText
    Exit Sub
End If

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

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

Dim sbResponseBody As New ChilkatStringBuilder
success = rest.FullRequestNoBodySb("DELETE","/rest/api/2/issue/SCRUM-13",sbResponseBody)
If (success <> 1) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

Dim respStatusCode As Long
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
    Debug.Print "Response Status Code = " & respStatusCode
    Debug.Print "Response Header:"
    Debug.Print rest.ResponseHeader
    Debug.Print "Response Body:"
    Debug.Print sbResponseBody.GetAsString()
    Exit Sub
End If

Dim jsonResponse As New ChilkatJsonObject
success = jsonResponse.LoadSb(sbResponseBody)

Dim i As Long
Dim count_i As Long
Dim strVal As String

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

Sample JSON Response Body

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