Rest 通过命令行向Jira添加新注释

Rest 通过命令行向Jira添加新注释,rest,curl,jira,Rest,Curl,Jira,我到处寻找这个,发现了一些缺乏像样例子的资源,比如,和 最有用的是。其中给出了以下结论: curl -D- -u myname:mypassword -X PUT -d "{\"fields\":{\"summary\":\"My title thru Curl\"}}" -H "Content-Type: application/json" http://localhost:portnum/jira/rest/api/2/issue/Issue-4 curl -D- -u uname:pas

我到处寻找这个,发现了一些缺乏像样例子的资源,比如,和

最有用的是。其中给出了以下结论:

curl -D- -u myname:mypassword -X PUT -d "{\"fields\":{\"summary\":\"My title thru Curl\"}}" -H "Content-Type: application/json" http://localhost:portnum/jira/rest/api/2/issue/Issue-4
curl -D- -u uname:pass -X PUT -d "{\"update\": {\"comment\": [{\"add\": {\"body\": \"Comment added when resolving issue\"}}]}}" -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/issue/KEY-12345

如何添加评论?

这可以通过执行以下操作来实现:

curl -D- -u myname:mypassword -X PUT -d "{\"fields\":{\"summary\":\"My title thru Curl\"}}" -H "Content-Type: application/json" http://localhost:portnum/jira/rest/api/2/issue/Issue-4
curl -D- -u uname:pass -X PUT -d "{\"update\": {\"comment\": [{\"add\": {\"body\": \"Comment added when resolving issue\"}}]}}" -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/issue/KEY-12345

我添加了一个,它提供了几个用例

我发现了另一个选项,即只添加一个新注释,而不修改问题本身(如果用户没有编辑权限,但只有注释权限,这可能会很好)

您应该只收到一个状态为“201”的响应,其中包含添加注释的完整json表示


现在在

中有很好的文档记录,我如何在jira中使用用户名添加评论?@Sureshkumarani用需要发表评论的用户的凭据替换
uname
pass
。大概是你吧。