2013-05-08 48 views
0

我發現如果我們傳遞定義ConversationPosts它將在Discussion標籤中創建註釋。但如何對話的列表添加到討論拉力賽的Java休息API如何在Rally java rest中添加註釋列表API

JsonObject newDefect = new JsonObject(); 
newDefect.addProperty("Type", "ConversationPost"); 
newDefect.addProperty("Text", "Test Comment 2"); 
newDefect.addProperty("Artifact",defectReference); 
newDefect.addProperty("User", userRef); 
CreateRequest createRequest = new CreateRequest("ConversationPost", defectObject); 
CreateResponse createResponse = rallyRestAPI.create(createRequest); 

如果我們需要增加2篇評論說:「測試點評1」,「測試點評2」相同的缺陷這可怎麼在一次執行中完成

+1

我們怎麼知道這是關於什麼的? – MarioDS 2013-05-08 07:03:25

回答

0

不幸的是,拉力賽的WSAPI沒有任何批處理創建/更新端點,因此您只需一次創建一個對話發佈項目。你的代碼看起來不錯。

String[] comments = {"Test Comment 1", "Test Comment 2"}; 
for(String comment : comments) { 
    JsonObject newDefect = new JsonObject(); 
    newDefect.addProperty("Type", "ConversationPost"); 
    newDefect.addProperty("Text", comment); 
    newDefect.addProperty("Artifact",defectReference); 
    newDefect.addProperty("User", userRef); 
    CreateRequest createRequest = new CreateRequest("ConversationPost", defectObject); 
    CreateResponse createResponse = rallyRestAPI.create(createRequest); 
} 
相關問題