Uncaught Ctct\Exceptions\CtctException: Bad Request

Occasional Participant

Uncaught Ctct\Exceptions\CtctException: Bad Request

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
Moderator

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

Moderator

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

Hi @David_B

 

Developer Portal

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

Visit Page