Reputation: 11
I am trying to access HP alm rest api.
i am able to get 200 OK response for /authentication-point/authenticate api
I am able to get 201 for POST /rest/site-session api. Session is being created.
but when i am trying to hit /rest/domain/{domain-name}/projects/{project-name}/defect; i am getting 401 status code with below error.
Reason - authentication failed
I tried to pass all headers from /authenticate and /site-session to this api. But still getting 401 error code.
Upvotes: 0
Views: 350
Reputation: 21
I also came across the same issue as Mahadev and i was able to resolve it.
The issue was the way in which the cookies was passed along the request.
Instead of this :
invocationBuilder.cookie("LWSSO_COOKIE_KEY", lswoocookie);
invocationBuilder.cookie("QCSession", qcsessioncookie);
res = invocationBuilder.get();
Pass the cookies in the header as a concatenated String as shown below:
String concatenatedHeaderCookieString = "QCSession=" + qcsessioncookie + ";" + "ALM_USER=" + ";" + almuser + ";" + "XSRF-TOKEN=" + xsrftoken + ";"+ "LWSSO_COOKIE_KEY=" + lswoocookie;
invocationBuilder.header("Cookie", concatenatedHeaderCookieString);
res = invocationBuilder.get();
Result : InboundJaxrsResponse{context=ClientResponse{method=GET, uri=https://xxxxx.xx.xxxxx.com/qcbin/rest/domains/RELEASES/projects/2019/defects/1, status=200, reason=OK}}
And this would work like a charm!
Upvotes: 1