问题
I am trying to use the Version One api to get the project and sprint burndown charts.
I am reading this page but I am just getting confused.
Has anybody done something similar and have any tips for how to hit the api to get what I want?
回答1:
The VersionOne api does not serve images or chart specific data. You can use the query language and the rest endpoint to produce the data that is needed for a burndown. You would need to be able to read/parse the data and produce a graph yourself.
With that being said, a burndown graph compares how much closed estimate versus how much open estimate and graphs that over time. So you need to know three pieces of data: open estimate, closed estimate, and time. You'll also want to limit it to a certain project (and it'd children).
This should get you close to the data you need for a project burndown:
http://<host>/VersionOne/rest-1.v1/Data/Timebox?where=Schedule.ScheduledScopes='Scope:1055'&sel=Name,BeginDate,EndDate,Workitems:Story[AssetState!='Closed'].Estimate.@Sum,Workitems:Story[AssetState='Closed'].Estimate.@Sum&sort=+EndDate
Be sure to change Scope:1055 to the project oid that you're interested in.
This is how I got there. First I was thinking "well you need to sum up a bunch of story estimates" so I thought I'd do a historical query of stories:
http://<host>/VersionOne.Web/rest-1.v1/Hist/Story?where=Scope.ParentMeAndUp='Scope:1055'
But quickly found that you cannot aggregate on your root. What that means is if I want to sum up estimate, I need to use something else like Project (scope) to get at the data:
http://<host>/VersionOne.Web/rest-1.v1/Hist/Scope/1055?sel=Workitems:Story[AssetState!='Closed'].Estimate.@Sum,Workitems:Story[AssetState='Closed'].Estimate.@Sum,ChangeDate
The problem with this query is is gives you what the closed versus open estimate looked like at weird intervals; namely whenever the project changed. So it wouldn't make a very nice looking graph.
But as you know VersionOne has a concept of Iterations and Schedules that are associated to a project, and stories are associated to iterations. So I used that as a root to query for and aggregate story estimates, and limit the data to projects that use that schedule.
The data that is produced is more regular (grouped by iteration) and contains correctly aggregated estimate data.
So what is left? You'll have to aggregate the aggregation of estimate data to get a total estimate number for your project. Then you'll need to produce a graph (maybe bar or line) where each data point is at the end of an iteration. You'll keep a running total of closed estimate and add that to the iteration's total to produce the data point.
回答2:
You need to do multiple queries to produce a burndown. First find the date range for the burndown:
/Data/Timebox?sel=BeginDate,EndDate&where=Name='X'
Now for every day the date range, sum up the ToDo hours as of that point in history:
/Hist/Timebox?asof=2013-08-09T23:59:59&where=Name='X'&sel=Workitems[Team.Name='Y';AssetState!='Dead'].ToDo.@Sum
The API and documentation are excellent. If you are interested in seeing the code for some custom reports, check out https://github.com/timothypratley/vone/blob/master/src/vone/models/queries.clj (the code is in Clojure). There is a burndown, cumulative flow, and more :)
回答3:
There is now a "recipe" to query for burndown data that works with the query.v1 API endpoint.
来源:https://stackoverflow.com/questions/13956826/how-do-i-use-the-version-one-api-to-get-project-and-sprint-burndown-charts