Rally Rest API .NET Toolkit Creating Defect/User Story with Tags -
i'm having trouble creating new defect or user story tag included. i've tried few different ways, , typically defect created in rally, no tags attached. looking @ rally api , source code toolkit, seems tags should in arraylist. here latest attempt. if can point me in right direction, appreciate it.
dynamicjsonobject itemtocreate = new dynamicjsonobject(); itemtocreate["project"] = project["_ref"]; arraylist taglist = new arraylist(); dynamicjsonobject mytag = new dynamicjsonobject(); mytag["_ref"] = "/tag/1435887928"; taglist.add(mytag); itemtocreate["tags"] = taglist; createresult itemtocreateresult = restapi.create(workspace["_ref"], "defect", itemtocreate);
you there:
arraylist taglist = new arraylist(); dynamicjsonobject mytag = new dynamicjsonobject(); mytag["_ref"] = "/tag/2222"; taglist.add(mytag); mystory["tags"] = taglist; updateresult = restapi.update(createresult.reference, mystory);
this code creates user story, finds tag based on ref , adds tag story:
using system; using system.collections.generic; using system.collections; using system.linq; using system.text; using rally.restapi; using rally.restapi.response; namespace rest_v2._0_test { 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"; //replace oid oid of workspace //create item dynamicjsonobject mystory = new dynamicjsonobject(); mystory["name"] = "abcdefg11"; createresult createresult = restapi.create(workspaceref, "hierarchicalrequirement", mystory); dynamicjsonobject s = restapi.getbyreference(createresult.reference, "formattedid"); console.writeline(s["formattedid"]); mystory["description"] = "this story."; operationresult updateresult = restapi.update(createresult.reference, mystory); arraylist taglist = new arraylist(); dynamicjsonobject mytag = new dynamicjsonobject(); mytag["_ref"] = "/tag/2222"; taglist.add(mytag); //update item mystory["tags"] = taglist; updateresult = restapi.update(createresult.reference, mystory); } } }
Comments
Post a Comment