I want to get defects that were transitioned from one state to another (for example Submitted to Fixed) within certain dates. I see that information in the revision history
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.