Here is an example of LookbackAPI query that looks for defects whose state was changed from Submitted (and higher) to Fixed within a certain timeframe:
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12352608129/artifact/snapshot/query.js?find={"State":"Fixed","_PreviousValues.State":{$gte:"Submitted"},_ValidFrom:{$gte:"2013-06-01TZ",$lt:"2013-07-011TZ"}},sort:{_ValidFrom:-1}}&fields=true&hydrate=["_PreviousValues","State"]&pagesize:20
Lookback API allows to see what any work item or collection of work items looked like in the past. This is different from using WS API directly, which can provide you with the current state of objects, but does not have historical data.
LBAPI documentation is available here
On a side note, it is possible to get state transition data in a custom app without using LBAPI if you query on defects and fetch RevisionHistory,Revisions and Description, and iterate over results parsing Description of individual revisions for "STATE changed" string:
if(results.mydefects[i].RevisionHistory.Revisions[j].Description.indexOf("STATE changed")>=0){ //....
but it can be expensive and inefficient. If you decide to do that please narrow the scope of your defect query.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…