Rally Software

 View Only
  • 1.  Web Services API OAuth Client access token

    Posted Jul 20, 2018 03:43 AM

    Hi!


    I am trying to use the CA Agile Central Web Services AP 2.0.

     

    I was able to create defects by using an API Key Header with my Requests.

     

    Unfortunately it doenst seem to be possible to also create projects with this approach.

     

    So I registred a "Full Access" OAuth Client within Application Manager and followed the OAuth Samples to get the neccessary access token.


    GitHub - RallySoftware/rally-oauth-examples
     

     

    I am able to use the first call

     

    https://rally1.rallydev.com/login/oauth2/auth

     

    and I received an auth token.

     

    When I try to exchange the auth token to an access token by using

     

    https://rally1.rallydev.com/login/oauth2/token

     

    I always receive an 404 error, telling me, that this URL doesnt exist.

     

    Any ideas on how to get the access token whch I can use within my Web Service Requests ?

    Many Thanks in advance!

    Regards,

    Hans



  • 2.  Re: Web Services API OAuth Client access token

    Posted Jul 20, 2018 06:39 AM

    Hans,

     

    It is possible to create Projects in the same way that you created Defects.  The issue you are facing is probably due to the permissions of the user being used.  In order to create Projects you have to be at least a Workspace Administrator to create Projects in a Workspace.  If your user is a Workspace or Subscription Administrator, please let us know and we can look into it via a case.

     

    I will also double check this oauth piece, but wanted to get you going on your project creation.

     

    Regards,


    Michael



  • 3.  Re: Web Services API OAuth Client access token
    Best Answer

    Posted Jul 20, 2018 08:13 AM

    Hi Michael!

    Thanx a lot for Your quick reply!

    It turned out, that the OAuth problem was related to the fact, that I did a "GET" instead of a "POST" request,

    I fixed that.

     

    I understand that using the API Key with the zsessionid header is not the prefrered way to access th Agile Central Web Service Api and using the OAuth approach is a more secure way.

     

    Interestingly my user is able to create Projects when I log in to Rally via the GUI, but not when I use the Web Service Api ?! Will the OAuth approach help me i this case because I added "Full Access" to my registerd OAuth client ?

     

    Following the OAth Samples Decription

    GitHub - RallySoftware/rally-oauth-examples 

    tells me to first use the resoponse_type=code and afterwards use grant_type=authorization_code
    Unfortunately this implies to provide a redirect-url which is not a practical way for us.

     

    I think I will user other grant_types (password, client_credentials) to bypass this problem.

     

    I very much appreciate any further hints, Thank You!

    Regards,
    Hans



  • 4.  Re: Web Services API OAuth Client access token

    Posted Jul 20, 2018 08:20 AM

    Hans,

     

    The API Key should be fine to use and if you can create Projects when logged in via the GUI, you should be able to create them when using your API Key.  So, now we really need to figure out why it isn't working for you.  Oauth is a fine way to go, but if we can't figure out why it isn't working with the API Key, it won't work with Oauth.

     

    So I am not guessing as to what may be the issue, is it possible to post your code as an attachment to this post?  Also, double check which Workspaces you are set as a Workspace Administrator in in Agile Central.  I wasn't going to guess, but my first hunch is you are trying to create a Project in a Workspace where you are not a Project Administrator.  Again, just a guess, but this is what we usually see in these cases.

     

    Anyway, if you can post the code using the API Key, with the API Key redacted, of course, I will see what we can do.

     

    Michael



  • 5.  Re: Web Services API OAuth Client access token

    Posted Jul 20, 2018 08:56 AM

    Hi Michael!
    I am using Postman to create the requests.within "CA Test Workspace", under the Project

    Project Playground / Project Strategy Organization / pesha test project, which I have created via the GUI.

    I attach a text file with my data.

     

    Thx & Regards,

    Hans



  • 6.  Re: Web Services API OAuth Client access token

    Posted Jul 25, 2018 05:34 AM

    Hans,

     

    I marked this answer as correct for this question as you fixed the OAuth problem.  I will still include the issue with creating the project via OAuth when you are a Project Administrator in the Defect I am filing.

     

    If you have any questions, please let me know.

     

    Michael