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'
var
rest: TChilkatRest;
success: Integer;
bTls: Integer;
port: Integer;
bAutoReconnect: Integer;
sbResponseBody: TChilkatStringBuilder;
respStatusCode: Integer;
jsonResponse: TChilkatJsonObject;
i: Integer;
count_i: Integer;
strVal: WideString;
begin
rest := TChilkatRest.Create(Self);
// 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
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(rest.ConnectFailReason));
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
rest.SetAuthBasic('jira@example.com','JIRA_API_TOKEN');
rest.AddHeader('Accept','application/json');
sbResponseBody := TChilkatStringBuilder.Create(Self);
success := rest.FullRequestNoBodySb('DELETE','/rest/api/2/issue/SCRUM-13',sbResponseBody.ControlInterface);
if (success <> 1) then
begin
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
respStatusCode := rest.ResponseStatusCode;
if (respStatusCode >= 400) then
begin
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
Memo1.Lines.Add('Response Header:');
Memo1.Lines.Add(rest.ResponseHeader);
Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(sbResponseBody.GetAsString());
Exit;
end;
jsonResponse := TChilkatJsonObject.Create(Self);
jsonResponse.LoadSb(sbResponseBody.ControlInterface);
i := 0;
count_i := jsonResponse.SizeOfArray('errorMessages');
while i < count_i do
begin
jsonResponse.I := i;
strVal := jsonResponse.StringOf('errorMessages[i]');
i := i + 1;
end;
{
"errorMessages": [
"You do not have permission to delete issues in this project."
],
"errors": {}
}