Rally Software

 View Only
  • 1.  How can I use the look back API to obtain the date each time a Features state was changed?

    Posted Mar 13, 2019 05:28 PM

    I thought that this could be obtained with the following end point: 

    "https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/14370822888/artifact/snapshot/query.js?find={\"ObjectID\":" + objectID + "}&fields=[\"State\",\"_ValidFrom\",\"_ValidTo\",\"ObjectID\"]&hydrate=[\"State\"]&compress=true"

     

    However from this I get 72 records of the feature's state being Accepted and nothing else. This features current state is Done, so I would want/expect to have a result for each different state that the feature has been through.

     

    Is this possible? I saw that this sort of response was received with a defect in an example within the docs. 

     

    Thanks in advanced! 



  • 2.  Re: How can I use the look back API to obtain the date each time a Features state was changed?
    Best Answer

    Broadcom Employee
    Posted Mar 14, 2019 11:06 AM

    Hi Dominic,

     

    In your query you are asking for all snapshots of your artifact by its ObjectID. Your 'find' clause doesn't include a condition such as that State has changed.

     

    Here is an example of how you can do that:

     

    This would be the 'find' clause:

    {$and: [{"ObjectID": 202805877388},{"_PreviousValues.State": {"$exists":true}}]}

     

    Here is the full query:

     

    https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/197887695532/artifact/snapshot/query.js?hydrate=["State","_PreviousValues.State"]&start=1&pagesize=2000&find={$and: [{"ObjectID": 202805877388},{"_PreviousValues.State": {"$exists":true}}]}&fields=["_SnapshotDate","_SnapshotNumber","FormattedID","Name","State","_PreviousValues.State"]

     

     

    You can see that I added a condition of _PreviousValues.State exists. What this essentially means is that the query is asking only for snapshots of this ObjectID which do have the State field in the list of _PreviousValues. You should know that State will be included in _PreviousValues only when it changes. Generally, the _PreviousValues only will hold fields that changed.

     

    In the full query URL you should replace the workspace objectID as well as the artifact ObjectID - to be what you need. You can see that we're asking for the _SnapshotDate which will give you the date you asked for and we're also hydrating on 'State' and '_PreviousValues.State' , which will show you the readable state values in your returned JSON.

     

    I hope this helps.

     

    Sagi



  • 3.  Re: How can I use the look back API to obtain the date each time a Features state was changed?

    Posted Mar 14, 2019 02:07 PM

    Hi Sagi, 

     

    This is exactly what I needed. I better understand how to use the LBAPI now! Thank you very much!

     

    Regards,

     

    Dominic