Visual FoxPro 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'

Visual FoxPro Example

LOCAL loRest
LOCAL lnSuccess
LOCAL lnBTls
LOCAL lnPort
LOCAL lnBAutoReconnect
LOCAL loSbResponseBody
LOCAL lnRespStatusCode

loRest = CreateObject('Chilkat_9_5_0.Rest')

*  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/comment/10019
lnBTls = 1
lnPort = 443
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("your-domain.atlassian.net",lnPort,lnBTls,lnBAutoReconnect)
IF (lnSuccess <> 1) THEN
    ? "ConnectFailReason: " + STR(loRest.ConnectFailReason)
    ? loRest.LastErrorText
    RELEASE loRest
    CANCEL
ENDIF

loRest.SetAuthBasic("jira@example.com","JIRA_API_TOKEN")

loRest.AddHeader("Accept","application/json")

loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("DELETE","/rest/api/2/issue/SCRUM-15/comment/10019",loSbResponseBody)
IF (lnSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    RELEASE loSbResponseBody
    CANCEL
ENDIF

lnRespStatusCode = loRest.ResponseStatusCode
IF (lnRespStatusCode >= 400) THEN
    ? "Response Status Code = " + STR(lnRespStatusCode)
    ? "Response Header:"
    ? loRest.ResponseHeader
    ? "Response Body:"
    ? loSbResponseBody.GetAsString()
    RELEASE loRest
    RELEASE loSbResponseBody
    CANCEL
ENDIF

RELEASE loRest
RELEASE loSbResponseBody