Rally 对象模型可用于网络服务API https://rally1.rallydev.com/slm/doc/webservice/文档。
HierarchicalRequirement(用户故事)对象上有Iteration属性,它是对Iteration对象的引用,因此可以通过迭代来查询故事。
您引用的手册特定于回溯API https://rally1.rallydev.com/analytics/doc/#/manual/,并且需要熟悉 WS API 文档中的对象模型。
下面是一个 LookbackAPI 端点,用于查询为三个迭代之一安排的用户故事,其中 222,333,444 是迭代的 ObjectID:
"Iteration" : {$in: [222,333,444]}
并获取'FormattedID','ScheduleState','PlanEstimate'
用户故事字段。
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/111/artifact/snapshot/query.js?find={"Iteration" : {$in: [222,333,444]},"_TypeHierarchy":"HierarchicalRequirement","__At" : "current"}&fields=['FormattedID','ScheduleState','PlanEstimate'],hydrate=['ScheduleState']
这是一个类似的 WS API 端点:
https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1119&query=(((Iteration.ObjectID = 222) OR (Iteration.ObjectID = 333)) OR (Iteration.ObjectID = 444))&fetch=FormattedID,ScheduleState,PlanEstimate&pagesize=200
两个查询返回相同的结果。
即使您想获取对象的当前状态,也可以使用 Lookback API 查询而不是 WS API 查询,如上面的示例中使用"__At" : "current"
,但 Lookback API 旨在提供历史数据。 WS API 仅返回对象的当前状态,而 Lookback API 可以及时返回这些对象的快照。
集会节点 https://github.com/RallyTools/rally-node does not具有对 Lookback API 的内置支持。
下面是一个集会节点示例,通过 3 次迭代查询故事:
var rally = require('rally'),
queryUtils = rally.util.query;
mySettings = {
apiKey: '_XYZ...',
server: 'https://rally1.rallydev.com', //this is the default
requestOptions: {
headers: {
'X-RallyIntegrationName': 'stories by iteration node.js program',
'X-RallyIntegrationVendor': 'My company'
'X-RallyIntegrationVersion': '1.0'
},
}
},
restApi = rally(mySettings);
var q = queryUtils.where('Iteration.ObjectID', '=', 222).or('Iteration.ObjectID', '=', 333).or('Iteration.ObjectID', '=', 444);
restApi.query({
type: 'hierarchicalrequirement'
fetch: ['FormattedID', 'Name', 'ScheduleState', 'PlanEstimate', 'Iteration'],
query: q,
scope: {
workspace: '/workspace/111',
},
}, function(error, result) {
if(error) {
console.log(error);
} else {
console.log(result.Results);
}
});