c# - RallyDev - Getting Tasks for Stories using Rally.RestAPI.dll and Service V2.0 -
i'm pulling data off rally server @ https://rally1.rallydev.com using c# , rally.restapi.dll. server upgraded webservice v2.0 , i'm having problems getting tasks user story. know way child collections presented changed in api move 2.0, i'm trying isn't working.
v2.0 removed ability return child collections in same response performance reasons. fetching collection return object count , url collection data.a separate request needed elements of collection. here code iterates on user story results, accesses "tasks" collection on stories , issues separate request access individual task attributes:
using system; using system.collections.generic; using system.collections; using system.linq; using system.text; using rally.restapi; using rally.restapi.response; namespace arestapp_collectionoftasks { class program { static void main(string[] args) { //initialize rest api rallyrestapi restapi; restapi = new rallyrestapi("user@co.com", "secret", "https://rally1.rallydev.com", "v2.0"); //set our workspace , project scopings string workspaceref = "/workspace/11111"; //please replace oid oid of workspace string projectref = "/project/22222"; //please replace oid oid of project bool projectscopingup = false; bool projectscopingdown = true; request storyrequest = new request("hierarchicalrequirement"); storyrequest.workspace = workspaceref; storyrequest.project = projectref; storyrequest.projectscopeup = projectscopingup; storyrequest.projectscopedown = projectscopingdown; storyrequest.fetch = new list<string>() { "name", "formattedid", "tasks", "estimate" }; storyrequest.query = new query("lastupdatedate", query.operator.greaterthan, "2013-08-01"); queryresult querystoryresults = restapi.query(storyrequest); foreach (var s in querystoryresults.results) { console.writeline("----------"); console.writeline("formattedid: " + s["formattedid"] + " name: " + s["name"]); //console.writeline("tasks ref: " + s["tasks"]._ref); request taskrequest = new request(s["tasks"]); queryresult querytaskresult = restapi.query(taskrequest); if (querytaskresult.totalresultcount > 0) { foreach (var t in querytaskresult.results) { var taskestimate = t["estimate"]; var taskname = t["name"]; console.writeline("task name: " + taskname + " estimate: " + taskestimate); } } else { console.writeline("no tasks found"); } } } } }
Comments
Post a Comment