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.

400 error trying to add a new contact

Highlighted
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
Highlighted
Employee

Post worked successfully

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

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