Is there anyone worked on HP ALM APIs with PHP?
I am getting the cookies from qcbin/api/authentication/sign-in API
But when I am trying to send these cookies to other subsequent APIs, its returning me httpcode 401 which is not authenticated.
Also i am using the qcbin/authentication-point/authenticate API and qcbin/api/site-session API to get and maintain the sessions.
My code is as follows:
$url = "https://myhost/qcbin/api/authentication/sign-in"; $credentials = $user . ':' . $password; $headers = array("GET /HTTP/1.1","Authorization: Basic ". base64_encode($credentials));
curl_setopt($qc, CURLOPT_URL, $url);
curl_setopt($qc, CURLOPT_HTTPGET,1);
curl_setopt($qc, CURLOPT_HTTPHEADER, $headers);
curl_setopt($qc, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($qc, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($qc);
$response = curl_getinfo($qc);
Then I am trying to get the test set folders:
$folder_name = "folder_name"; $safe_name = rawurlencode($folder_name); $url = "https://myhost/qcbin/rest/domains/NETWORKS_QUALITY/projects/NETWORKS/test-set-folders?query={name['" . $safe_name . "']}";
$qc = curl_init();
curl_setopt($qc, CURLOPT_URL, $url);
//curl_setopt($qc, CURLOPT_HTTPHEADER, $headers);
curl_setopt($qc, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($qc, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($qc, CURLOPT_COOKIE,$ckfile);
curl_setopt($qc, CURLOPT_COOKIEFILE, $ckfile);
curl_setopt($qc, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($qc, CURLOPT_VERBOSE, true);
$result = curl_exec($qc);
$response = curl_getinfo($qc);
this response returns me httpcode 401 instead of 200. Please help me if anybody worked on this before.
Thank you Biswajit Jena