Not able set Feature to a user story: there is no "Feature" field or a tab on User Story editable details page.
To set Feature in via Web Services API:
The steps in the UI may create a wrong expectation that to set a Feature on a User Story, a Parent attribute of a HierarchicalRequriement object has to be set. However, in the UI the "Parent" field has a more general, casual meaning.
In WSAPI Parent field on a Hierarchical Requirement(a.k.a. user story) is expected to be another Hierarchical Requirement. It cannot be a Feature. Also, Feature field on a story is read-only, and UserStories collection on Feature is read-only. That leaves us with the option to update PortfolioItem field on a story.
Per WS API object model a HierarchiclaRequirement object has Parent attribute that points to another HierarchiclaRequirement (a Parent story), a Feature attribute that references PI/Feature object that could be either its direct PI/Feature parent or the parent of it's parent user story, and a PortfolioItem attribute that points to its immediate PI/Feature parent.
Here is a Ruby example based on CA Agile Central Ruby REST Toolkit that set's Feature on a User Story. Regardless of your choice of language or a toolkit, your code should follow the same idea, since it is working within the same WS API:
require 'rally_api' #Setup custom app information headers = RallyAPI::CustomHttpHeader.new() headers.name = "My Utility" headers.vendor = "NM RallyLab" headers.version = "1.0" # Connection to CA Agile Central config = {:base_url => "https://rally1.rallydev.com/slm"} config[:username] = "<User>@<Company.com>" config[:password] = "<PASSWORD>" config[:workspace] = "<WORKSPACE_NAME>" config[:project] = "<PROJECT_NAME>" config[:headers] = headers #from RallyAPI::CustomHttpHeader.new() @rally = RallyAPI::RallyRestJson.new(config) obj = {} obj["Name"] = "new story efd" new_s = @rally.create("hierarchicalrequirement", obj) query = RallyAPI::RallyQuery.new() query.type = "portfolioitem" query.fetch = "Name,FormattedID" query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/<WORKSPACE_OID>" } query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/<PROJECT_OID>" } query.query_string = "(FormattedID = \"F22\")" result = @rally.find(query) feature = result.first field_updates={"PortfolioItem" => feature} new_s.update(field_updates)