Classic ASP 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'

Classic ASP Example

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set rest = Server.CreateObject("Chilkat_9_5_0.Rest")

'  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-13
bTls = 1
port = 443
bAutoReconnect = 1
success = rest.Connect("your-domain.atlassian.net",port,bTls,bAutoReconnect)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( "ConnectFailReason: " & rest.ConnectFailReason) & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( rest.LastErrorText) & "</pre>"

End If

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

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

set sbResponseBody = Server.CreateObject("Chilkat_9_5_0.StringBuilder")
success = rest.FullRequestNoBodySb("DELETE","/rest/api/2/issue/SCRUM-13",sbResponseBody)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( rest.LastErrorText) & "</pre>"

End If

respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Response Status Code = " & respStatusCode) & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( "Response Header:") & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( rest.ResponseHeader) & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( "Response Body:") & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( sbResponseBody.GetAsString()) & "</pre>"

End If

set jsonResponse = Server.CreateObject("Chilkat_9_5_0.JsonObject")
success = jsonResponse.LoadSb(sbResponseBody)

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

%>
</body>
</html>

Sample JSON Response Body

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