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:  
1


Number of Errors:  
1


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>


    <updated>2008-07-23T14:21:06.407Z</updated>


    <author></author>


    <id>data:,none</id>


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


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


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


            <EmailAddress>test1900@example.com</EmailAddress>


            <FirstName></FirstName>


            <LastName></LastName>


            <JobTitle></JobTitle>


            <CompanyName></CompanyName>


            <WorkPhone></WorkPhone>


            <Addr1></Addr1>


            <Addr2></Addr2>


            <City></City>


            <StateName></StateName>


            <CountryName></CountryName>


            <PostalCode></PostalCode>


            <OptInSource>ACTION_BY_CUSTOMER</OptInSource>


            <ContactLists>


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


            </ContactLists>


        </Contact>


    </content>


</entry>


 


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!


 


 

3 REPLIES 3
Employee

Hello,


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.


Regards,

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