Server api error

23 views
Skip to first unread message

cont...@candelaypicapica.com

unread,
May 16, 2016, 8:48:47 AM5/16/16
to CleverTap Support
Hi,

Hi,


I’m trying to use the server api to post a charged event but I always get an error. My php code looks like:


$events = '[{"WZRK_G":"c9a9f18c0e5e43048cbee329476b3d1f","ts":1463402032,"type":"event","evtName":"Charged","evtData":{"Amount":10.8,"Currency":"EUR","Charged ID":330455,"Items":[{"Quantity":1,"Number":"xxxxx"}]}}]’;


$params = array( 

  "d" => $events

);

$ch = curl_init("https://api.clevertap.com/up?id=my_account_id&p=my_passcode");

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $params);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_TIMEOUT, 180);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

$start = time();

$getResult = curl_exec($ch);

$stop = time();

if(curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200) { 

  Logger::getLogger('clevertap')->error("Error: " . curl_errno($ch) . " -> " . curl_error($ch)); 

} else {

 Logger::getLogger('clevertap')->debug("Clevertap result:".$getResult);

}


I tried a lot of combinations for $params value without success.


What is wrong?


Thanks,

CleverTap Support

unread,
May 16, 2016, 9:11:02 AM5/16/16
to CleverTap Support
Hello Manel,

Please switch to the new end point : https://api.clevertap.com/1/upload

This will log the error in your request.

- Support.
Reply all
Reply to author
Forward
0 new messages