如何使用java Rally-Rest-API为用户素材创建缺陷/任务。任何人都可以拥有拉力赛查询的属性可用的链接吗?
提前致谢
答案 0 :(得分:0)
您可以在此处找到Java REST API简介:
https://developer.help.rallydev.com/java-toolkit-rally-rest-api
关于Rally的Webservices API的文档:
https://rally1.rallydev.com/slm/doc/webservice
要创建新的缺陷并将其与故事相关联,您可以执行以下操作:
// Query for Story to associate with Defect
String storyFormattedID = "US20142";
QueryRequest storyRequest = new QueryRequest("HierarchicalRequirement");
storyRequest.setFetch(new Fetch("FormattedID","Name","Changesets"));
storyRequest.setQueryFilter(new QueryFilter("FormattedID", "=", storyFormattedID));
QueryResponse storyQueryResponse = restApi.query(storyRequest);
JsonObject storyJsonObject = storyQueryResponse.getResults().get(0).getAsJsonObject();
String storyRef = storyJsonObject.get("_ref").toString();
JsonObject newDefect = new JsonObject();
newDefect.addProperty("Name", "Test Defect");
newDefect.addProperty("Priority", "High Attention");
newDefect.addProperty("Severity", "Major Problem");
newDefect.addProperty("Requirement", storyRef);
CreateRequest storyCreateRequest = new CreateRequest("defect", newDefect);
CreateResponse storyCreateResponse = restApi.create(storyCreateRequest);
任务的过程非常相似:
// Create a new Task and associate to the same Requirement
JsonObject newTask = new JsonObject();
newTask.addProperty("Name", "Test Task");
newTask.addProperty("State", "Defined");
newDefect.addProperty("WorkProduct", storyRef);
CreateRequest taskCreateRequest = new CreateRequest("task", newTask);
CreateResponse taskCreateResponse = restApi.create(taskCreateRequest);