The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

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

Highlighted
Visitor

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
Highlighted
Moderator

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

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

Highlighted
New Member

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

No error code or message displayed.

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

Highlighted
Moderator

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

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

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured