Rally Software

 View Only
  • 1.  Rally Authentication issue in Getting results

    Posted Feb 20, 2017 09:07 AM

    I am using asp.net MVC application and consuming Rally web API for integration. I want fetch the data from rally site.

     

    in Login Controller
    ------------------

     

                    RallyRestApi restApi = new RallyRestApi(webServiceVersion: "v2.0");
                    dynamic authenticateUser=restApi.Authenticate(usr.UserName, usr.Password, "https://rally1.rallydev.com/", allowSSO: false);
                    dynamic objUserName;
                    if (authenticateUser.ToString().ToLower() == "authenticated")
                    {
                        Session["Username"] = usr.UserName;
                        Session["Password"] = usr.Password;                   
                        FormsAuthentication.SetAuthCookie(usr.UserName, true);
                        FormsAuthentication.SetAuthCookie(usr.Password, true);
                        objUserName = restApi.GetCurrentUser();
                        Session["DisplayName"] = objUserName["DisplayName"];
                        return RedirectToAction("Home", "PortfolioItem");
                    }
    Here Authentication is successful. But as per my research, if we want to fetch data every time,  I think we need to pass user authentication details like below:

     

              
              CreateResult createResult = restApi.Create("defect", toCreate); // need to get with same restApi object or authentication details

     

             
              OperationResult updateResult = restApi.Update(createResult.Reference, toUpdate);

     

              //Get the item
              DynamicJsonObject item = restApi.GetByReference(createResult.Reference);// need to get with same restApi object or authentication details

     

              //Query for items
              Request request = new Request("defect");
              request.Fetch = new List<string>() { "Name", "Description", "FormattedID" };
              request.Query = new Query("Name", Query.Operator.Equals, "My Defect");
              QueryResult queryResult = restApi.Query(request); // need to get with same restApi object or authentication details

     

     
    Like above, is it if we need to fetch anything, we need to authenticate first and every time? please clarify on this.



  • 2.  Re: Rally Authentication issue in Getting results

    Posted Feb 21, 2017 02:24 PM

    Hi Sanjay,

     

    Are you asking if you need to make a call to the restAPI.Authenticate method each time you run a restAPI.<Request Method> ?

     

    You only need to run Authenticate once, then you can make the subsequent restAPI.<Method> calls to fetch data.

     

    Thanks,

    Sean Davis

     



  • 3.  Re: Rally Authentication issue in Getting results

    Posted Feb 22, 2017 09:58 AM

    Thanks for the reply, I have multiple users to access the Rally, is it for every action we need to authenticate the user ? if not , can you please give me how the approach we will do on this?



  • 4.  Re: Rally Authentication issue in Getting results

    Posted Feb 22, 2017 02:49 PM

    Hi Sanjay,

    Will users of this application be required to login? What type of application are you creating? Once you set this:

    RallyRestApi restApi = new RallyRestApi(webServiceVersion: "v2.0");
                    dynamic authenticateUser=restApi.Authenticate(usr.UserName, usr.Password, "https://rally1.rallydev.com/", allowSSO: false);

     

    Every time restAPI.<method> is called it is using the authentication which was set above.  I would think you might use a general CA Agile Central subscription admin account, or is it that you need each user to only access what they have permission in CA Agile? If that was the case you could set the login information in user.UserName and usr.Password for each instance of the application. So basically the code would remain generic as you have it, but for each new login to your application the usr.UserName and usr.Password would be set according to the login information.

     

    Let me know if that helps,

    Thanks,

    Sean Davis