2014-03-07 45 views
1

我在這個地方找到了這個地方,發現一些資源缺乏體面的例子,如here,herehere通過命令行向Jira添加新評論

最有幫助的是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 

如何添加評論?

回答

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這給了一些用例

+0

我如何能在JIRA添加註釋與用戶名? –

+0

@SureshKumarAmrani用需要發表評論的用戶的憑證替換'uname'和'pass'。想必你。 – TheMightyLlama

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