如何使用JAVA Rest API从Rally workitem下载附件?
我找不到一个有效的例子。 我试着从下面开始 但是我得到了一个如何使用JAVA Rest API从Rally workitem下载附件?,java,rest,attachment,rally,Java,Rest,Attachment,Rally,我找不到一个有效的例子。 我试着从下面开始 但是我得到了一个ClasscastException,因为JsonObject不能强制转换为JsonArray JsonArray attachmentsJsonArray=existUserStoryJsonObject.getAsJsonArray(“附件”) 为了使用CA Agile Central Webservices v2.0,需要对旧答案中引用的代码进行一些小的更新。您可以在此处找到该示例的修改版本: 其中包括WSAPI v2.0更新
ClasscastException
,因为JsonObject
不能强制转换为JsonArray
JsonArray attachmentsJsonArray=existUserStoryJsonObject.getAsJsonArray(“附件”)代码>
为了使用CA Agile Central Webservices v2.0,需要对旧答案中引用的代码进行一些小的更新。您可以在此处找到该示例的修改版本:
其中包括WSAPI v2.0更新
QueryRequest existUserStoryRequest = new QueryRequest("HierarchicalRequirement");
existUserStoryRequest.setFetch(new Fetch("FormattedID","Name","Attachments"));
existUserStoryRequest.setQueryFilter(new QueryFilter("FormattedID", "=", existStoryFormattedID));
QueryResponse userStoryQueryResponse = restApi.query(existUserStoryRequest);
JsonObject existUserStoryJsonObject = userStoryQueryResponse.getResults().get(0).getAsJsonObject();
String existUserStoryRef = userStoryQueryResponse.getResults().get(0).getAsJsonObject().get("_ref").toString();
JsonArray attachmentsJsonArray = existUserStoryJsonObject.getAsJsonArray("Attachments");