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

Document ID : KB000057593
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

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/123456/artifact/snapshot/query.js?find={"_TypeHierarchy":"
HierarchicalRequirement",_ValidFrom:{$gte: "2014-04-01T19:00:00.000Z",$lt: "2014-04-01T21:00:00.000Z"}}}&fields=["FormattedID"]

Make sure to replace 123456 with valid ObjectID of your workspace.

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.

Instructions:
Please Update This Required Field