将特性作为子项添加到initiative(php api)

将特性作为子项添加到initiative(php api),php,rally,Php,Rally,我如何将功能作为儿童添加到预先存在的计划中?我假设这与您在功能中更新状态的方式相同: Connection::rally()->update('feature',feature_objectId,array('state'=>$stateId)); 这就是我如何将代码添加(更新子项字段)子项(功能)到计划中的方法: Connection::rally()->update('initiative','13298601606',array('children'=>'13298601665');

我如何将功能作为儿童添加到预先存在的计划中?我假设这与您在功能中更新状态的方式相同:

Connection::rally()->update('feature',feature_objectId,array('state'=>$stateId));
这就是我如何将代码添加(更新子项字段)子项(功能)到计划中的方法:

Connection::rally()->update('initiative','13298601606',array('children'=>'13298601665');
第一个对象Id用于我要向其添加功能的计划,第二个Id用于作为子计划添加的功能


为什么这不起作用?有人知道怎么做吗?

WS-API中的Initiative对象的子集合是只读的

下面是一段Ruby代码,它创建了一个新功能,并通过更新新功能的父字段将其添加到现有的计划中:

require 'rally_api'


#Setup custom app information
headers = RallyAPI::CustomHttpHeader.new()
headers.name = "My Utility: add feature to initiative"
headers.vendor = "Nick M RallyLab"
headers.version = "1.0"

# Connection to Rally
config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:username] = "user@co.com"
config[:password] = "secret"
config[:workspace] = "W1"
config[:project] = "P1"
config[:headers] = headers #from RallyAPI::CustomHttpHeader.new()

@rally = RallyAPI::RallyRestJson.new(config)

obj = {}
obj["Name"] = "new feature abc456"
new_f = @rally.create("portfolioitem/feature", obj)

query = RallyAPI::RallyQuery.new()
query.type = "portfolioitem/initiative"
query.fetch = "Name,FormattedID"
query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1111" } 
query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/2222" }
query.query_string = "(FormattedID = \"I1\")"

result = @rally.find(query)
initiative = result.first

field_updates={"Parent" => initiative}
new_f.update(field_updates)

WS-API中Initiative对象的子集合是只读的

下面是一段Ruby代码,它创建了一个新功能,并通过更新新功能的父字段将其添加到现有的计划中:

require 'rally_api'


#Setup custom app information
headers = RallyAPI::CustomHttpHeader.new()
headers.name = "My Utility: add feature to initiative"
headers.vendor = "Nick M RallyLab"
headers.version = "1.0"

# Connection to Rally
config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:username] = "user@co.com"
config[:password] = "secret"
config[:workspace] = "W1"
config[:project] = "P1"
config[:headers] = headers #from RallyAPI::CustomHttpHeader.new()

@rally = RallyAPI::RallyRestJson.new(config)

obj = {}
obj["Name"] = "new feature abc456"
new_f = @rally.create("portfolioitem/feature", obj)

query = RallyAPI::RallyQuery.new()
query.type = "portfolioitem/initiative"
query.fetch = "Name,FormattedID"
query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1111" } 
query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/2222" }
query.query_string = "(FormattedID = \"I1\")"

result = @rally.find(query)
initiative = result.first

field_updates={"Parent" => initiative}
new_f.update(field_updates)

是的,这奏效了!这可能是为了实现这一点而剪掉的php代码:
$rally->update(“feature”、$feature['ObjectID'],array('Parent'=>$initiative['ObjectID'])是的,这成功了!这可能是为了实现这一点而剪掉的php代码:
$rally->update(“feature”、$feature['ObjectID'],array('Parent'=>$initiative['ObjectID'])