C++ 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'

C++ Example

#include <CkRest.h>
#include <CkStringBuilder.h>

void ChilkatSample(void)
    {
    CkRest rest;
    bool success;

    //  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/comment/10019
    bool bTls = true;
    int port = 443;
    bool bAutoReconnect = true;
    success = rest.Connect("your-domain.atlassian.net",port,bTls,bAutoReconnect);
    if (success != true) {
        std::cout << "ConnectFailReason: " << rest.get_ConnectFailReason() << "\r\n";
        std::cout << rest.lastErrorText() << "\r\n";
        return;
    }

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

    rest.AddHeader("Accept","application/json");

    CkStringBuilder sbResponseBody;
    success = rest.FullRequestNoBodySb("DELETE","/rest/api/2/issue/SCRUM-15/comment/10019",sbResponseBody);
    if (success != true) {
        std::cout << rest.lastErrorText() << "\r\n";
        return;
    }

    int respStatusCode = rest.get_ResponseStatusCode();
    if (respStatusCode >= 400) {
        std::cout << "Response Status Code = " << respStatusCode << "\r\n";
        std::cout << "Response Header:" << "\r\n";
        std::cout << rest.responseHeader() << "\r\n";
        std::cout << "Response Body:" << "\r\n";
        std::cout << sbResponseBody.getAsString() << "\r\n";
        return;
    }
    }