How to access HP ALM using REST and local javascri

2019-08-12 09:44发布

问题:

I just want to access ALM via local written javascript js in the browser (IE11, Firefox) via the REST API but I can not login. Here is my code for requesting the LWSSO cookie via jquery:

var auth = btoa(USER+":"+PASSWORD);

$.ajax({
    type: "POST",
    url: https://alm.xxx.net/qcbin/authentication-point/j_spring_security_check,
    headers: {
        "Authorization": "Basic " + auth
    },
    success : function(data) { },
});

The response header contains:

https://alm.xxx.net/qcbin/authentication-point/login.jsp;jsessionid=1gfsdk4pn525f1ur55e2x2zzte?login_error

With OTA/directX object everything works fine but I want to use the REST API via javascript. Can anyone help me?

回答1:

First of all; which version of ALM are you using? Second, I think you are using the wrong URL for the authentication point. According to the documentation (for ALM 12.01) it should be https://alm.xxx.net/qcbin/authentication-point/authenticate.

Also, the HTTP method you use should be GET, not POST.

I noticed that you are using https in the URL, so I assume your instance of ALM is set up with that?