RanonKahn
RanonKahn

Reputation: 872

Adding comment to a JIRA issue ticket using REST API in R

I would like to add more comments to an existing JIRA ticket using REST API pro grammatically from R

I tried the following based on this link in this forum but did not work:

library(httr)

POST("https://xxxxxx.atlassian.net/rest/api/2/issue/issueId/comment",body = "New Comment", authenticate(userid,password, "basic"))

Upvotes: 1

Views: 951

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522712

I checked the accepted answer in your forum link, which suggests the following POST using curl:

curl -u admin:admin -X POST --data '{"body": "comment."}' -H "Content-type: application/json" http://localhost:2990/jira/rest/api/2/issue/TEST-1/comment

Note carefully that the body is JSON content, with the content type also being set as JSON. You may try doing the same in your call to the POST() function from httr:

POST("https://xxxxxx.atlassian.net/rest/api/2/issue/issueId/comment",
    body = '{"body": "comment."}', authenticate(userid, password, "basic"),
    encode="raw")

Upvotes: 1

Related Questions