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.

HTTP Status 401 - Unable to authenticate user myaccount

Highlighted
Occasional Contributor

HTTP Status 401 - Unable to authenticate user myaccount

Hi,

I'm trying to communcate with ConstantConact API using PHP  below:

$ConstantContact = new Constantcontact("basic", myapi, myusername, mypass);

 

if i put wrong credentail, I got 401 error. This is OK, i understand this error but this gets diplay on my page. I want to catch the error and show some user friendly error message to user on page.

 

try {
        // Create ConstantContact object and call to ConstantContact api
       $ConstantContact = new Constantcontact("basic", myapi, myusername, mypass);
        
        // Get ConstantContact's account lists
        return $ConstantContact->getLists();
    } catch(Exception $ex) {
    
    }

 

I'm not able to catch the error and i always get the ConstantConact error list on whole page like below:

http://screencast.com/t/yax7I73kpcyW

 

Can you please help me that if my user enter invalid credential and error is returned back then how can i catch this error and show my user friendly errro message to user? Thanks

 

2 REPLIES 2
Highlighted
Valued Contributor

Re: HTTP Status 401 - Unable to authenticate user myaccount

Hello,

 

Thank you for reaching out to us! I'd like to suggest that you actually check out developer.constantcontact.com or e-mail webservices@constantcontact.com for API related questions. We have a team dedicated and trained to handle these types of inquiries and you'll have much better luck getting your questions answered. Thank you so much!

 

Joe


If you find my post helpful, and it answers your question, please mark it as an "Accepted Solution"


Highlighted
Moderator

Re: HTTP Status 401 - Unable to authenticate user myaccount

I put up a respone to your thread in the Getting Started section here: http://community.constantcontact.com/t5/Getting-Started-with-API-s/HTTP-Status-401-Unable-to-authent...

 

Dave Berard
Senior Product Manager, Constant Contact
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