I'm new to the REST APIs style of web development. I have to send 2 cookies along with 1 REST API. How do I send them together by clicking on a link?
For example, if an user clicks on the link, it is supposed to make the REST API call and send the cookie along with it. I know how to do it in the cURL but I am confused as to how I can trigger that via a link. Ideally, the user should be able to download a zip file by clicking the link. The link should call the REST API and send 2 cookies over to get the zip file. I am able to get the raw code of the zip file using the following code but is not able to achieve that by clicking on the link.
$getResultsDetails = curl_init();
$getResults_service_url = '<URL of the REST API call>';
curl_setopt($getResultsDetails,CURLOPT_URL,$getResults_service_url);
curl_setopt($getResultsDetails,CURLOPT_COOKIE,"LWSSO_COOKIE_KEY=".$LWSSO_COOKIE_KEY.";QCSession=".$QCSession);
curl_setopt($getResultsDetails, CURLOPT_RETURNTRANSFER, true); //get response
$getResults_service_url_response = curl_exec($getResultsDetails);
curl_setopt($getResultsDetails, CURLOPT_RETURNTRANSFER, true);
if ($getResults_service_url_response === false) {
$info = curl_getinfo($getResultsDetails);
curl_close($getResultsDetails);
die('error occured during curl exec. Additional info: ' . var_export($info));
}
curl_close($getResultsDetails);
Any ideas how I can achieve that?