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

时间:2014-03-07 17:21:31

标签: rest curl jira

我在这个地方寻找了这个,发现了一些资源缺乏像hereherehere这样的优秀例子。

最有帮助的是this one。给出了以下内容:

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

如何添加评论?

2 个答案:

答案 0 :(得分:1)

我发现另一个选项只是在不修改问题本身的情况下添加新评论(当用户没有编辑权限但只能评论时可能会很好。)

curl -D- -u uname:pass -X PUT -d "{\"body\": \"Comment added when resolving issue\"}" -H "Content-Type: application/json" http://jira-server:8080/jira/rest/api/2/issue/KEY-12345/comment

您应该收到状态为" 201"用添加评论的完整json表示。

现在已在https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-add-comment

中详细记录

答案 1 :(得分:0)

这可以通过以下方式实现:

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

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

相关问题