为了账号安全,请及时绑定邮箱和手机立即绑定

使用 Java Rally Rest API 提取 Rally 缺陷讨论

使用 Java Rally Rest API 提取 Rally 缺陷讨论

大话西游666 2022-12-21 16:47:54
我正在尝试创建一个简单的 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


查看完整回答
反对 回复 2022-12-21
  • 1 回答
  • 0 关注
  • 50 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信