AnsweredAssumed Answered

Get user story information via .Net API

Question asked by 6f737a2c82066ab260b335047a7d0cb5 on Feb 13, 2016
I am trying to retrieve user story information, name, description, etc from a user story ID into a .Net application.  I am able to retrieve defect and task information, but can not for the life of me, pull user story information.  

Here is my c# code.  Assume I have a valid login and I am authenticated.

 RallyRestApi restApi = new RallyRestApi();
            RallyRestApi.AuthenticationResult conn = restApi.Authenticate(username, password, serverUrl, proxy: null, allowSSO: false);
            if (!(conn.ToString().Equals("Authenticated")))
            {
                Console.WriteLine("Can't Authenticate");
                //Console.WriteLine("Authenticated User");
                Console.ReadLine();
                System.Environment.Exit(1);
            }
            Console.WriteLine(conn);
            //US2034
            //UserStory, Defect, Task, DefectSuite, TestCase or TestSet

            Request request = new Request("userstory");
            request.Fetch = new List<string>() { "Name", "Description", "FormattedID" };
            request.Query = new Query("FormattedID", Query.Operator.Contains, "2");
            QueryResult queryResults = restApi.Query(request);
            Console.WriteLine(queryResults.Results.Count());
            foreach (var result in queryResults.Results)
            {
                Console.WriteLine(result.FormattedID);
            }
            Console.ReadLine();
        }
    }
}

Outcomes