Adding lists, no response Success or Fail

krnmrdth
Regular Participant

Adding lists, no response Success or Fail

Hi,


I accidentally posted this to the wrong forum on another thread.  I hope this is now the correct one.




I have been trying to learn the API, and when I send a request to create a new list, the function in

$result = CC_Utility->doServerCall(),

it initially worked, but never returned anything into $result success or fail.

Looking at the code for the return, it seems like something should come back:

function doServerCall()

{

.....

           $emessage = curl_exec($ch);          

           if ($this->curl_debug) {   echo $error = curl_error($ch);   }

           curl_close($ch);

           

           return $emessage;

}

How do I tell if it worked or not?

Thanks

2 REPLIES 2
bsoder
Employee

Hello,



When using our PHP sample code, the cc_class.php by default does not have error reporting turned on.  To get the file to return the error codes, towards the top of cc_class.php, there is a setting:



var $curl_debug = false; // Set this to true to see the response code returned by cURL



If you make it true, it will return the errors.



If you have any questions about this, please feel free to let me know.



Regards,

Benjamin Soder
NOC Analyst
Constant Contact
krnmrdth
Regular Participant

Thanks for the response, but I think you mis-understood what was happening.



The curl call is working, it is the API response that I was interested in.  The requests are working, I'm just not getting any confirmation or failure indication from the API.


 


ie:  I send a request to Add a List that already exists, I would expect a response that says its a Duplicate or something, or a response that says it was successful if it was not a Duplicate.


 


Also, it occurred to me that it was possible that the results/responses were asynchronous, ie: you queued the request and created a callback to a service that I needed to setup on our side to receive the response.  Are all the calls synchronous, ie: completed at the time of the request.


 


OK, I just found your Error response Documentation, and I turned on the curl.  I guess you are passing the Errors as just numbers via the curl errors.






I've got it now.


 


Thanks for your help in advance.

Developer Portal

View API documentation, code samples, get your API key.

Visit Page