$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://smartly.simaametrics.com/api/qr/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer NSJcmWkkvxfdteEK",
"Content-Type: application/json",
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
How do I convert the Above into javascript to work in the google app script? Using above i am fetching values about specific ID
you must convert that response to json using:
$json = json_encode($response)
and then convert that json to javascript object using:
JSON.parse($json)