We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Add List using V2 API to Constant Contact account is not working

febd
Participant

Add List using V2 API to Constant Contact account is not working

I use the below code to add list to the constant contact account using V2 Api.

$contactlist = new ContactList();
$contactlist->name = $_POST['name'];
$contactlist->status = 'ACTIVE';
$response = $cc->listService->addList(APIKEY, $contactlist);

But this is not working. 

 

Add or Update contact, get list, get contact etc are working...

3 REPLIES 3
David_B.
Moderator

Hello,

 

Thank you for reaching out to Constant Contact API Developer Support.

 

What is the error response code and message you see when making these calls?


Regards,

 

David B.
Tier II API Support Engineer

No error code or message displayed.

By looking the code Is there any mistake there in the code? Or am missing something?

Hello,

 

It looks like you are using our PHP SDK library, correct? If so, errors do not display on their own so you would need to add in code that would provide this. For example, you could replace the last line in the code example you provided with this:

try {
    $response = $cc->listService->addList(APIKEY, $contactlist);
} catch (CtctException $ex) {
    foreach ($ex->getErrors() as $error) {
        print_r($error);
    }
}

This will provide us with each error you see which will tell us what the problem may be.

 

Regards,

David B.
Tier II API Support Engineer

 

Developer Portal

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

Visit Page