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.

403 Forbidden error and "email address (invalid format) (invalid format)"

Occasional Participant

403 Forbidden error and "email address (invalid format) (invalid format)"

 Recently, the code we use to allow for instant registration from clients' websites stopped working. When a new contact is PUT to the api, a 403 Forbidden error is returned. Viewing activities, I can see that the server attempted to add an email, but encountered an error:


Number of Contacts:  

Number of Errors:  

Invalid Email Addresses:  
email address (invalid format) (invalid format)



This is the XML that was sent, with the client's info changed to caps:



<entry xmlns="http://www.w3.org/2005/Atom">

    <title type="text"></title>




    <summary type="text">Contact</summary>

    <content type="application/vnd.ctct+xml">

        <Contact xmlns="http://ws.constantcontact.com/ns/1.0/">















                <ContactList id="http://api.constantcontact.com/ws/customers/CLIENT_USER_NAME/lists/7/" />






I'm fairly confident this is not an issue with my credentials. 1) They have no changed, and the code worked fine up until around the 17th of June. 2) I can still use the credentials fine when sending GET operations. 3) The credentials work fine when adding a contact using the Activities API.

I don't know if it means anything, but I changed my code to catch Forbidden errors and in that case try to use Activities instead. This works, but still generates an error in the Activity list:

Number of Contacts:   2
Number of Errors:   1
Invalid Email Addresses:   email address (invalid format)

(The difference being one "(invalid format)" instead of two.)


My thought is that something changed in the API that is now causing an issue with the way (just my?) xml is being parsed, as this would explain why the code worked fine up until a few weeks ago. However, it's certainly possible there's still something wrong with my code, and I can provide any code or runtime debugging information that might help.

Any help would be appreciated, as I'd rather not add single contacts with Activities if I don't have to! Thanks!





I posted your XML to my test account and it did work on my end. It is possible that there is something causing your account to return this and it could also be something with your code. Please send an email to the webservices support team with your user name and also the code that you are using to post this XML.


Benjamin Soder
NOC Analyst
Constant Contact
Occasional Participant

Ok, I've sent off the email with attached code files and a quick run-down on what all the class is doing. I'll try to post again once I know what the problem is, in case someone else encounters it. 

Occasional Participant

I think I found the problem -- my code was using http:// for the non-activities uri, instead of https://. For whatever reason, this used to work fine, but doesn't anymore. Switching it over to https seems to have resolved the problem. 

Developer Portal

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

Visit Page