Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to make use of JRS REST API via native http client??

 Hi there,


I am trying to fetch information(Report Managers details) in the JRS application of IBM ALM(6.0.4-version) using JAZZ REST API -
https://<Server>/rs/setup?method=reportManagers

I have been using native client HttpClient-4.X to achieve this. 
I have configured my http client as below -

1. configured not to validate certificates from server (So it allows all the requests and responses)
2. configured to use https protocol
3. configured with default user credentials

Please find the piece of code that i am trying to execute -

String requestUrl = "https://<Server>/rs/setup?method=reportManagers";
HttpClient httpClient = Utils.createCloseableHttpClient("userId", "userPassword");
HttpResponse documentResponse = httpClient.execute(httpGetRequest);

After execution the response throws - "401 Unauthorized" please find the response object content as below -

HttpResponseProxy{HTTP/1.1 401 Unauthorized [Date: Thu, 07 Dec 2017 07:32:08 GMT, X-Powered-By: Servlet/3.0, Cache-Control: private, no-store, no-cache, must-revalidate, Pragma: no-cache, X-FRAME-OPTIONS: SAMEORIGIN, errMsg: Unauthorized%20user, X-jazz-web-oauth-url: https://<Server>/jts/oauth-authorize?oauth_token=86e3157f893649c2afa97522f1fcd65a&oauth_callback=https%3A%2F%2F<Server>%2Frs%2Fsetup%3Fmethod%3DreportManagers%26request_token_secret%3DQwBnOcZPJMZOPqXcMOsldKeq8af2Q5MG1eQxNq4I, Vary: Accept-Encoding, Keep-Alive: timeout=10, max=100, Connection: Keep-Alive, Transfer-Encoding: chunked, Content-Type: application/json; charset=UTF-8, Content-Language: en-US] org.apache.http.client.entity.DecompressingEntity@750cd36d}

I could understand that the request internally calls OAuth authentication and retrieves the oauth_token and request_token_secret. 
But later fails to authenticate the user in resource server.

Hence i tried 
1. to hold credentials by using cache and cookies set to http client. Still the result is same.
2. Disabled the redirect, Still the result is same

Please let me know -
1. Am i trying to achieve the goal in right way?
2. Or there is different way to deal with JRS application's REST API.

Thank you in advance.

0 votes


Be the first one to answer this question!

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 7,495

Question asked: Dec 08 '17, 1:36 a.m.

Question was seen: 2,417 times

Last updated: Dec 11 '17, 2:12 a.m.

Confirmation Cancel Confirm