How to add a comments to jira issue using rest api

北城余情 提交于 2019-12-22 12:32:09

问题


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?


回答1:


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




回答2:


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())


来源:https://stackoverflow.com/questions/20566363/how-to-add-a-comments-to-jira-issue-using-rest-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!