PHP ActiveX Jira - Issues: Delete a Comment

Back to Index

Deletes a comment. This example deletes comment (id=10019) for the issue with key = "SCRUM-15". A successful response is indicated by a 204 response code with no response body.

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

CURL Command

curl --request DELETE --user jira@example.com:JIRA_API_TOKEN \
  --header 'Accept: application/json' \
  --url 'https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/comment/10019'

PHP ActiveX Example

<?php

$rest = new COM("Chilkat_9_5_0.Rest");

//  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/comment/10019
$bTls = 1;
$port = 443;
$bAutoReconnect = 1;
$success = $rest->Connect('your-domain.atlassian.net',$port,$bTls,$bAutoReconnect);
if ($success != 1) {
    print 'ConnectFailReason: ' . $rest->ConnectFailReason . "\n";
    print $rest->LastErrorText . "\n";
    exit;
}

$rest->SetAuthBasic('jira@example.com','JIRA_API_TOKEN');

$rest->AddHeader('Accept','application/json');

$sbResponseBody = new COM("Chilkat_9_5_0.StringBuilder");
$success = $rest->FullRequestNoBodySb('DELETE','/rest/api/2/issue/SCRUM-15/comment/10019',$sbResponseBody);
if ($success != 1) {
    print $rest->LastErrorText . "\n";
    exit;
}

$respStatusCode = $rest->ResponseStatusCode;
if ($respStatusCode >= 400) {
    print 'Response Status Code = ' . $respStatusCode . "\n";
    print 'Response Header:' . "\n";
    print $rest->ResponseHeader . "\n";
    print 'Response Body:' . "\n";
    print $sbResponseBody->getAsString() . "\n";
    exit;
}


?>