cmj
cmj

Reputation: 43

How to add a comments to jira issue using rest api

Refered AnotherJiraClient code found in nuget package

Refered this https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Add+Comment to add a comment.

    var request = new RestRequest()
    {
        Resource = ResourceUrls.Comment(),
        RequestFormat = DataFormat.Json,
        Method = Method.POST
    };
    request.AddBody(addComment);//{"body":"Something"}

    return Execute<BasicIssue>(request, HttpStatusCode.Created);

But always returned with status not found? How to add comments using Jira REST API?

Upvotes: 3

Views: 11514

Answers (2)

RanonKahn
RanonKahn

Reputation: 862

I figured out what was I mssing in the code. I need to provide the comment as an json object.

library(httr)
library(RJSONIO)

x <- toJSON(list(body = "Adding a new Comment"))

POST("https://xxxxxx.atlassian.net/rest/api/2/issue/{issueIdOrKey}/comment",body = x, authenticate(userid,password, "basic"), add_headers("Content-Type" = "application/json"), verbose())

Upvotes: 1

Karan Bhandari
Karan Bhandari

Reputation: 506

You should use Jira's REST API to append a comment . See this link https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-add-comments-using-rest-api/qaq-p/571351

Upvotes: 0

Related Questions