LBAPI: Get IDs of artifacts changed within a specific date/time interval
search cancel

LBAPI: Get IDs of artifacts changed within a specific date/time interval

book

Article ID: 57593

calendar_today

Updated On:

Products

Rally On-Premise Rally SaaS

Issue/Introduction

Get IDs of artifacts changed within a specific date/time interval

Environment

Release:
Component: ACSAAS

Resolution

Lookback API provides a concise and least expensive syntax for getting artifacts modified within a specific time frame. The endpoint example below will return snapshots created inside a two hour window:

https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/<WORKSAPCE_OID>/artifact/snapshot/query.js?find={"_TypeHierarchy":"

HierarchicalRequirement",_ValidFrom:{$gte: "2014-04-01T19:00:00.000Z",$lt: "2014-04-01T21:00:00.000Z"}}}&fields=["FormattedID"]


However, the snapshots returned by this query will not include changes to Description field or other rich text fields, or other fields that are not stored by Lookback API. Please see "Unavailable Fields" section of LBAPI documentation.

As a workaround, a WS API query can be used.

Fetching Revision History is expensive. This means that the subset of the artifacts for which you get RevisionHistory has to be small. In this example only stories updated withing the last 4 weeks are used:

var howFarBack = rally.sdk.util.DateTime.add(new Date(), "week", -4);
var howFarBackISO = rally.sdk.util.DateTime.toIsoString(howFarBack);
function itemQuery() {
 var queryObject = {
 key: 's', type: 'HierarchicalRequirement',
 fetch: 'Name,ObjectID,FormattedID,RevisionHistory,Revisions,RevisionDescription,CreationDate,LastUpdateDate,Description',
 query: '(LastUpdateDate > "' + howFarBackISO + '")'
};
//....

The full code for this AppSDK1 app is available in this github repo.