0

I am referring official documentaion of alm for this task. http://alm-help.saas.hpe.com/en/12.50/api_refs/REST/webframe.htm#sign_in.htm

My code is

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
var USER = "username";
var PASSWORD = "password";
var auth = btoa(USER+":"+PASSWORD);

$.ajax({
    type: "POST",
    url: "https://example.com/qcbin/api/authentication/sign-in",
    
    headers: {
        "Authorization": "Basic " + auth
    },
    success : function(data) {
     alert("suc : "+data);
    },
    error : function(data){
     alert("err : "+data);
    }
});
</script>
</head>
<body>

</body>
</html>

Output

Output of the program

  • Explain what the issue is and what are you expecting to be? – yogidilip Mar 21 '17 at 20:16
  • http://stackoverflow.com/questions/16465085/ajax-post-to-external-url Is there a reason why you wanna do it with Jquery? – Barney Mar 22 '17 at 03:19
  • I want defect list in my apps, and want to schedule which one is open or close and for same i want report in my mail by scheduler. I have to do in Salesforce.com – Rajni kant roy Mar 22 '17 at 06:13

1 Answers1

0

Assuming that the REST ALM API is enabled (this is not in all cases), then you should be able to see the error that is coming back.

In previous versions I am using of QC ALM REST API, I used a different url to connect to REST interface:

POST QC_Server/qcbin/authentication-point/authenticate headers

I think the address used may be wrong (you can try it out). Then I think the "btoa" command will create the base64 encoding of the all together "username:password".

Last but not least the headers may need something like "Content-Type":"application/json" or "Content-Type":"application/xml"

Hope this can help a bit. Have a nice day!

Marco smdm
  • 1,020
  • 1
  • 15
  • 25