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.

The requested URL returned error: 400

Highlighted
Regular Visitor

The requested URL returned error: 400

I noticed that existing contacts (by email search) were not getting updated thorugh the API.

Here is my XML request:

 

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
    <title>TitleNode</title>
    <updated>2014-05-14T18:57:30+01:00</updated>
    <author>
        <name>CTCT Samples</name>
    </author>
    <id>http://api.constantcontact.com/ws/customers/myclient/contacts/10001</id>
    <summary type="text">Customer document</summary>
    <content type="application/vnd.ctct+xml">
        <Contact xmlns="http://ws.constantcontact.com/ns/1.0/">Customer document<EmailAddress>myemail@mycomp.tld</EmailAddress>
            <FirstName>My</FirstName>
            <LastName>Name</LastName>
            <MiddleName/>
            <CompanyName/>
            <JobTitle/>
            <OptInSource>ACTION_BY_CUSTOMER</OptInSource>
            <HomePhone>435-555-5555</HomePhone>
            <WorkPhone/>
            <Addr1>101 N Way</Addr1>
            <Addr2/>
            <Addr3/>
            <City>My City</City>
            <StateCode>State</StateCode>
            <StateName/>
            <CountryCode>us</CountryCode>
            <PostalCode>90210</PostalCode>
            <SubPostalCode/>
            <Note/>
            <EmailType>HTML</EmailType>
            <CustomField1>No</CustomField1>
            <CustomField2>ertwert</CustomField2>
            <CustomField3>wert</CustomField3>
            <CustomField4/>
            <CustomField5/>
            <CustomField6/>
            <CustomField7/>
            <CustomField8/>
            <CustomField9/>
            <CustomField10/>
            <CustomField11/>
            <CustomField12/>
            <CustomField13/>
            <CustomField14/>
            <CustomField15/>
            <ContactLists>
                <ContactList id="http://api.constantcontact.com/ws/customers/myclient/lists/3"/>
                <ContactList id="http://api.constantcontact.com/ws/customers/myclient/lists/8"/>
                <ContactList id="http://api.constantcontact.com/ws/customers/myclient/lists/21"/>
                <ContactList id="http://api.constantcontact.com/ws/customers/myclient/lists/3"/>
                <ContactList id="http://api.constantcontact.com/ws/customers/myclient/lists/8"/>
                <ContactList id="http://api.constantcontact.com/ws/customers/myclient/lists/21"/>
                <ContactList id="https://api.constantcontact.com/ws/customers/myclient/lists/1"/>
            </ContactLists>
        </Contact>
    </content>
</entry>

For which I'm getting a 400 error.

 

The requested URL returned error: 400

Can anyone see where I'm going wrong?

 

1 REPLY 1
Highlighted
Honored Contributor

Re: The requested URL returned error: 400

Hello,

 

I want to start by apologizing for my delay in getting back to you on this. Based on the XML that you have provided, I can see a few potential issues:

 

1. You have a single contact list ID that begins with https:// while the format for the ID URIs is to begin with http://

2. Your StateCode field element contains the word State rather than a valid two-character state code (Such as MA)

2a. Your StateName field should contain the matching full name of the state specified in the StateCode field (Such as Massachusetts)

3. You have specified the same lists (3,8,21) twice in your request. They should only listed once per unique list ID.

 

Hopefully this is enough information to help you get this issue sorted out. If these items do not provide enough information to get this request working, you will want to make sure that you capture the HTTP Response text when you receive a 400 error. This response text will contain an error message describing what the problem is and may provide enough information to correct the problem.

 

Best Regards,

Elijah G.
API Support Engineer
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