I've successfully made a call to the rest api using curl like this:
$curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, $_POST["logInEmail"] . ":" . $_POST["logInPassword"]); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_URL, "http://<theURL>/api/session"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); curl_close($curl); echo $result; //for testing, otherwise it would be inside a function and use return...
However, my work project is not in php, so I can't use this. I tried with AJAX but I get "Cross-Origin Request Blocked", so I have to look into doing this in Razor (cshtml).
I'd like to know if it is even possible to write this in cshtml.