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'
#include <C_CkRest.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>
void ChilkatSample(void)
{
HCkRest rest;
BOOL success;
BOOL bTls;
int port;
BOOL bAutoReconnect;
HCkStringBuilder sbResponseBody;
int respStatusCode;
HCkJsonObject jsonResponse;
int i;
int count_i;
const char *strVal;
rest = CkRest_Create();
// URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-13
bTls = TRUE;
port = 443;
bAutoReconnect = TRUE;
success = CkRest_Connect(rest,"your-domain.atlassian.net",port,bTls,bAutoReconnect);
if (success != TRUE) {
printf("ConnectFailReason: %d\n",CkRest_getConnectFailReason(rest));
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
return;
}
CkRest_SetAuthBasic(rest,"jira@example.com","JIRA_API_TOKEN");
CkRest_AddHeader(rest,"Accept","application/json");
sbResponseBody = CkStringBuilder_Create();
success = CkRest_FullRequestNoBodySb(rest,"DELETE","/rest/api/2/issue/SCRUM-13",sbResponseBody);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
return;
}
respStatusCode = CkRest_getResponseStatusCode(rest);
if (respStatusCode >= 400) {
printf("Response Status Code = %d\n",respStatusCode);
printf("Response Header:\n");
printf("%s\n",CkRest_responseHeader(rest));
printf("Response Body:\n");
printf("%s\n",CkStringBuilder_getAsString(sbResponseBody));
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
return;
}
jsonResponse = CkJsonObject_Create();
CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
i = 0;
count_i = CkJsonObject_SizeOfArray(jsonResponse,"errorMessages");
while (i < count_i) {
CkJsonObject_putI(jsonResponse,i);
strVal = CkJsonObject_stringOf(jsonResponse,"errorMessages[i]");
i = i + 1;
}
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jsonResponse);
}
{
"errorMessages": [
"You do not have permission to delete issues in this project."
],
"errors": {}
}