【问题标题】:Adding a new comment to Jira via the command line通过命令行向 Jira 添加新注释
【发布时间】:2014-03-07 17:21:30
【问题描述】:

我到处寻找这个,发现一些资源缺乏像样的例子,例如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

如何添加评论?

【问题讨论】:

    标签: rest curl jira


    【解决方案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 中有很好的记录

    【讨论】:

      【解决方案2】:

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

      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,它提供了几个用例

      【讨论】:

      • 如何使用用户名在 jira 中添加 cmets?
      • @SureshKumarAmrani 将 unamepass 替换为需要发表评论的用户的凭据。大概是你。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-10
      • 2015-05-03
      • 1970-01-01
      • 2017-12-23
      • 2019-06-21
      • 1970-01-01
      • 2011-12-31
      相关资源
      最近更新 更多