如何使用Rest API向Jira问题添加评论 [英] How to add a comments to jira issue using rest api

查看:245
本文介绍了如何使用Rest API向Jira问题添加评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在nuget包中找到了AnotherJiraClient代码

Refered AnotherJiraClient code found in nuget package

已引用此 https://developer.atlassian.com/display/JIRADEV/JIRA + REST + API + Example +-+ Add + Comment 添加评论.

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

但是总是以未找到状态返回吗? 如何使用Jira REST API添加评论?

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

推荐答案

我弄清楚我在代码中输入了什么.我需要将注释作为json对象提供.

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

这篇关于如何使用Rest API向Jira问题添加评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆