Lookback API:将Schedule State ObjectIDs映射到字符串

时间:2012-05-23 18:30:57

标签: rally lookbackapi

当我进行如下查询时,我注意到了这一点:

   https://rally1.rallydev.com/analytics/1.27/41529001/artifact/snapshot/query.js?find={ _Type: "HierarchicalRequirement",ScheduleState:"In-Progress",__At:"current"},fields=true

我的结果收集回来了:

   {"_rallyAPIMajor":"1","_rallyAPIMinor":"27","Errors":[],"Warnings":[],"ThreadStats":{"elapsedCpu":"10.0","waitTime":"0","blockedTime":"0","waitCount":"0","blockedCount":"0"},"Timings":{"preProcess":10.0,"findEtlDate":0.0,"allowedValuesDisambiguation":0.0,"mongoQuery":0.0,"authorization":0.0,"postProcess":0.0,"other":0.0,"TOTAL":10.0},"GeneratedQuery":{"find":{"ScheduleState":{"$in":[41529076]},"$and":[{"_ValidFrom":{"$lte":"2012-05-23T18:25:41.363Z"},"_ValidTo":{"$gt":"2012-05-23T18:25:41.363Z"}}],"_ValidFrom":{"$lte":"2012-05-23T18:25:41.363Z"}},"workspace":41529001},"TotalResultCount":2205,"StartIndex":0,"PageSize":100,"ETLDate":"2012-05-23T18:25:41.363Z","Results": ... RESULTS HERE

我对这方面感到好奇:

  "ScheduleState":{"$in":[41529076]}

其中显示了Schedule State的ObjectID(OID)而不是String值。是否有一种简单的方法来取回Schedule State字符串而不是OID?查找从Schedule State OID到Strings的映射的最佳方法是什么?

1 个答案:

答案 0 :(得分:2)

更新:Lookback API最近已升级为包含水合物功能以解决此问题。这是它的工作原理......

<强>水合物

默认情况下,在响应期间,此API不会尝试将下拉字段值从其本机ObjectID整数形式消除歧义为字符串。但是,您可以使用以下语法指定一些要水合的字段:

hydrate: ["State", "ScheduleState"]

这会将State和ScheduleState字段消除歧义为字符串。请注意,Analytics API使用当前允许的值来消除歧义。快照中可能会引用较旧的值。那些OID不会消除歧义。