Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Message":"There was an error processing the request.","StackTrace":"","ExceptionType" - JQUERY

Here is my code, I keep on getting the same error response.

"{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}"

I can't figure it out. I'm using Eloqua APIs to get basic information such as total number of accounts, landing pages, users, images, etc. It's weird because I tried the API on POSTMAN application and it did work perfectly Screenshot of postman response to the API

PHP

$objetos = array("data/accounts", "data/contacts", "assets/emails", "assets/landingPages", "assets/images", "assets/forms", "system/users", "assets/microsites", "assets/customObjects");

for ($i = 0; $i < 9; $i++){

   $url = 'http://secure.p03.eloqua.com/API/REST/1.0/' . $objetos[$i] . '?count=1';

   $ch=curl_init();
   curl_setopt($ch,CURLOPT_URL,$url);

   $headers = array(
       'Content-type: application/json',
       'Authorization: BASIC "MY TOKEN"'
   );
   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
   curl_setopt($ch, CURLOPT_CAINFO, getcwd() ."/EloquaApi_lvl1.cer");

   curl_setopt($ch, CURLOPT_POST, 0);
   curl_setopt($ch, CURLOPT_HTTPGET, 1);

   $data[$i] = curl_exec($ch);
   curl_close($ch);
}
echo json_encode($data);

 ?>

JS

function getObjetos(){

$.get("objetos.php", function (data) {
    console.log(data);
}, "json").done(function (data) {
    console.log(data);

// rest of my code 
}

Console console.log response (click for image)

like image 878
Edgar Serna Avatar asked Apr 17 '26 23:04

Edgar Serna


1 Answers

Try changing the url http://secure.p03.eloqua.com/API/REST/1.0/ to https

like image 51
Oscar Fraxedas Avatar answered Apr 20 '26 13:04

Oscar Fraxedas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!