我正在嘗試創建一個簡單的 Java 腳本,它將連接到 Rally,獲取所有缺陷并返回缺陷詳細信息,包括作為 Java 對象的討論。這里的問題是討論作為我認為的集合返回,因為只給出了一個 URL。我堅持如何將缺陷的討論作為 JSON 中的對象返回,而不是僅返回另一個必須單獨運行的查詢(我假設有數千次,因為我們有數千個缺陷)。這是我的代碼:import java.io.IOException;import java.net.URI;import java.net.URISyntaxException;import com.google.gson.JsonArray;import com.google.gson.JsonElement;import com.google.gson.JsonObject;import com.google.gson.JsonParser;import com.rallydev.rest.RallyRestApi;import com.rallydev.rest.request.GetRequest;import com.rallydev.rest.request.QueryRequest;import com.rallydev.rest.request.UpdateRequest;import com.rallydev.rest.response.QueryResponse;import com.rallydev.rest.util.Fetch;import com.rallydev.rest.util.QueryFilter;import com.rallydev.rest.util.Ref;import org.json.simple.JSONArray;public class ExtractData{ public static void main(String[] args) throws URISyntaxException, IOException, NumberFormatException { RallyRestApi restApi = new RallyRestApi(new URI("https://rally1.rallydev.com"), "apiKeyHere"); restApi.setProxy(URI.create("http://usernameHere:passwordHere0@proxyHere:8080")); restApi.setApplicationName("QueryExample"); //Will store all of the parsed defect data JSONArray defectData = new JSONArray(); try{ QueryRequest defects = new QueryRequest("defect"); defects.setFetch(new Fetch("FormattedID","Discussion","Resolution")); defects.setQueryFilter(new QueryFilter("Resolution","=","Configuration Change")); defects.setPageSize(5000); defects.setLimit(5000); } }}=如您所見,討論將作為 URL 返回,而不是獲取實際討論。由于此查詢將在運行時使用,因此我更喜歡整個對象。
1 回答

狐的傳說
TA貢獻1804條經驗 獲得超3個贊
不幸的是,沒有辦法在一個請求中獲取所有這些數據——您必須為您閱讀的每個缺陷加載 Discussion 集合。還要注意,最大頁面大小為 2000。
這與您嘗試做的并不完全相同,但此示例顯示了加載子故事,就像您加載討論一樣......
https://github.com/RallyCommunity/rally-java-rest-apps/blob/master/GetChildStories.java#L37
添加回答
舉報
0/150
提交
取消