How to fetch the user roles in a project area in RRC programmatically?
We are working on RRC extension where I am trying to fetch the roles assigned to a user in the RRC Project area. Following is the code :
HttpGet query = new HttpGet("https://aab.acd.com/rm/process/project-areas/_Yt5AsiOrEeSYxYvpIWViQA/members/userName");
query.addHeader("Accept", "application/xml");
I am getting a 401 Unauthorized Response. I am able to access the response xml from a normal browser. Am I missing out on anything? |
One answer
The URL should be the right one. I have tried it in different browsers and cURL but not been able to get an HTTP 401 error. With a logged in session, the response is HTTP 200 with the user information including <jp06:role-assignments>. Without a logged in session, the response is HTTP 302 and the response contains the log in page. If the logged-in user has no repository permission, the response is HTTP 403.
Note that normally we POST the user name and password to the "j_security_check" URL to log in (where CLM is by default configured to use FORM authentication). The way you put user name/password in HTTP headers is for BASIC authentication.
https://jazz.net/wiki/bin/view/Main/JazzFormBasedAuth
https://jazz.net/library/article/1206
Comments 1
Thanks Donald, and right, you should use the form based POST to get through the OAuth dance to get authenticated.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
What does the response content say, any details in the error message?
And do you have a user session with the RM server, i.e. are you authenticated?
And note that what you are trying to do is not part of the public REST API that RM and the Jazz platform provides.
The error message simply states Unauthorized with an error code 401. I tried authenticating using the login credentials. But the issue persists.
query.addHeader(BasicScheme.authenticate(new UsernamePasswordCredentials(login, password), "UTF-8",false));
Is there some other way to fetch the user roles in a project area?