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.

400 error trying to add a new contact

hube02
Occasional Participant

400 error trying to add a new contact

getting a 400 error when trying to add a contact.


Here's then XML


 


<?xml version="1.0" encoding="UTF-8"?>

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

    <title>TitleNode</title>

    <updated>2010-12-08T08:23:45+01:00</updated>

    <author><name>CTCT Samples</name></author>

    <id>data:,</id>

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

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

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

            <EmailAddress>test10@gmail.com</EmailAddress>

            <FirstName>My Name</FirstName>

            <LastName></LastName>

            <MiddleName></MiddleName>

            <CompanyName>Site-Seeker, Inc.</CompanyName>

            <JobTitle></JobTitle>

            <OptInSource>ACTION_BY_CUSTOMER</OptInSource>

            <HomePhone></HomePhone>

            <WorkPhone></WorkPhone>

            <Addr1></Addr1>

            <Addr2></Addr2>

            <Addr3></Addr3>

            <City></City>

            <StateCode></StateCode>

            <StateName></StateName>

            <CountryCode></CountryCode>

            <PostalCode></PostalCode>

            <SubPostalCode></SubPostalCode>

            <Note></Note>

            <EmailType></EmailType>

            <CustomField1></CustomField1>

            <CustomField2></CustomField2>

            <CustomField3></CustomField3>

            <CustomField4></CustomField4>

            <CustomField5></CustomField5>

            <CustomField6></CustomField6>

            <CustomField7></CustomField7>

            <CustomField8></CustomField8>

            <CustomField9></CustomField9>

            <CustomField10></CustomField10>

            <CustomField11></CustomField11>

            <CustomField12></CustomField12>

            <CustomField13></CustomField13>

            <CustomField14></CustomField14>

            <CustomField15></CustomField15>

            <ContactLists>

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

            </ContactLists>

        </Contact>

    </content>

</entry>

1 REPLY 1
bsoder
Employee

Hello,



Posting this to my Contact Collection worked successfully.  This usually means that the contact list ID that you have (ID 2) is not a valid list ID.  You would want to get a list of valid lists that you have in your account by doing a GET http request on your List collection URI.  This will give a list of the lists in your account, and they will have the List ID that you will need to specify when adding a contact.



Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Developer Portal

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

Visit Page