Hi guys,
how to assign api key in asp.net webform ?
i would like to call rest api value from this url "https://api.rajaongkir.com/starter/province?id=12"
to call api value i must assign API key from my codebehind, how to add api key in my codebehind ?
i just get tutorial in php version, how to in asp.net ?
this is code api key if using PHP.
<?php$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.rajaongkir.com/starter/province?id=12",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array("key: your-api-key"
),
));$response = curl_exec($curl);$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>Thank you & Regards.
Wibowo Wiwit