Swift 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'

Swift Example


func chilkatTest() {
    let rest = CkoRest()
    var success: Bool

    //  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/comment/10019
    var bTls: Bool = true
    var port: Int = 443
    var bAutoReconnect: Bool = true
    success = rest.Connect("your-domain.atlassian.net", port: port, tls: bTls, autoReconnect: bAutoReconnect)
    if success != true {
        print("ConnectFailReason: \(rest.ConnectFailReason.intValue)")
        print("\(rest.LastErrorText)")
        return
    }

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

    rest.AddHeader("Accept", value: "application/json")

    let sbResponseBody = CkoStringBuilder()
    success = rest.FullRequestNoBodySb("DELETE", uriPath: "/rest/api/2/issue/SCRUM-15/comment/10019", sb: sbResponseBody)
    if success != true {
        print("\(rest.LastErrorText)")
        return
    }

    var respStatusCode: Int = rest.ResponseStatusCode.intValue
    if respStatusCode >= 400 {
        print("Response Status Code = \(respStatusCode)")
        print("Response Header:")
        print("\(rest.ResponseHeader)")
        print("Response Body:")
        print("\(sbResponseBody.GetAsString())")
        return
    }


}