Master email marketing fundamentals. Join the Ready, Set, Send Challenge Week 2!

Uncaught Ctct\Exceptions\CtctException: Bad Request

AnjuG8
Rookie
0 Votes

Hi,

 

When I am trying to get the contact using the email list id in php, I got some fatal error.

"Fatal error: Uncaught Ctct\Exceptions\CtctException: Bad Request in /html/membersthrive/constantcontact-api/src/Ctct/Services/BaseService.php:100 Stack trace: #0 /html/membersthrive/constantcontact-api/src/Ctct/Services/ContactService.php(67)"

 

My Code is:

$params = array("limit" => 500, "status" => 'ACTIVE');
$listId = '1565890233';
$contacts = $cc->contactService->getContactsFromList($accessToken, $listId, $params); 

 

I don't know what wrong I did. Please help me to fix this issue.

 

Thank you.

3 REPLIES 3
David_B.
Employee
0 Votes

Hello,

 

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

 

Is this the only call you are getting this error with?

 

I'll also be doing some digging on my end to see if I can replicate.

 

Please reply if you have any other questions!

 

Regards,

 

David B.
Tier II API Support Engineer

David_B.
Employee
0 Votes

Hello,

 

After reviewing this further I found the issue.

 

When you are using getContactsFromList() any contacts that are returned would be in an ACTIVE status, so it is not expecting to see a STATUS parameter. If you remove that from your $params array, it should function normally.

 

Please give this a try and let me know if you have any other questions.

 

Regards,

 

David B.
Tier II API Support Engineer

anjug2
Rookie
0 Votes

Hi @David_B

 

Resources
Developer Portal

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up