cancel
Showing results for 
Search instead for 
Did you mean: 

400 status code with update of contact

Highlighted
Occasional Contributor

400 status code with update of contact

Hello,

 

We are using the xml V1 of the API, and the C# dot net library linked on your site here https://community.constantcontact.com/t5/Documentation/V1-XML-API-Documentation/ba-p/25125.

 


I have seen it work fine before but now we are getting a 400 response from the constant contact server when we send a request. Below is the format of our xml request, the request object's content type is being set as "application/atom+xml", as well as its accept property. Any ideas on what the issue could be?

 

Example request:

<entry xmlns="http://www.w3.org/2005/Atom">
    <title type="text"></title>
    <updated>2008-07-23T14:21:06.407Z</updated>
    <author>
        <name>Constant Contact</name>
    </author>
    <id>http://api.constantcontact.com/ws/customers/{redacted}/contacts/10749</id>
    <summary type="text">Contact</summary>
    <content type="application/vnd.ctct+xml">
        <Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/{redacted}/contacts/10749">
            <EmailAddress>{redacted}</EmailAddress>
            <FirstName>Unisource</FirstName>
            <LastName>Worldwide</LastName>
            <MiddleName></MiddleName>
            <OptInSource>ACTION_BY_CUSTOMER</OptInSource>
            <HomePhone>{redacted}</HomePhone>
            <Addr1>{redacted}</Addr1>
            <Addr2></Addr2>
            <Addr3></Addr3>
            <City>JACKSONVILLE</City>
            <StateCode>FL</StateCode>
            <StateName></StateName>
            <CountryCode></CountryCode>
            <CountryName></CountryName>
            <PostalCode>32232</PostalCode>
            <SubPostalCode></SubPostalCode>
            <EmailType>HTML</EmailType>
            <WorkPhone>{redacted}</WorkPhone>
            <JobTitle></JobTitle>
            <CompanyName>Unisource</CompanyName>
            <Note></Note>
            <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/{redacted}/lists/2" />
            </ContactLists>
        </Contact>
    </content>
</entry>

 

3 REPLIES 3
Moderator

Re: 400 status code with update of contact

I formatted your response to remove personal information.  Looking at the payload, there doesn't appear to be any errors in the formatting or data.  Can you share the response body that we're returning with the 400 error message? 

Dave Berard
Senior Product Manager, Constant Contact
Occasional Contributor

Re: 400 status code with update of contact

Hi Dave,

Thanks for your quick reply. Here is the response from the server.

 

"Error 400: Received Bad HttpResponse: 409 Conflict ActiveRecord::JDBCError: Column 'contact_id' cannot be null: INSERT INTO `service_addresses` (`account_id`, `address`, `contact_id`, `create_source`, `created_at`, `deleted_at`, `kind`, `service_address_id`, `sort_order`, `type`, `update_source`, `updated_at`) VALUES (1105491688575, '314-919-1800', NULL, 'A', '2014-03-26 20:23:59', NULL, 'work', x'9028cd10b52411e38141d4ae52a68661', 0, 'PhoneNumber', 'A', '2014-03-26 20:23:59')"

 

It says the contact id is null, is this not the correct contact id?

http://api.constantcontact.com/ws/customers/jitmail/contacts/10749

 

We are storing your contactid once we search on an email through the api and get the contact record. That way when we want to access the contact in the future we can just go strait to it using the api, instead of searching for the email using the api which appears to perform slower.

 

In an unrelated topic is there a way to get the contact id's from you guys when we export data?

 

Moderator

Re: 400 status code with update of contact

Thanks, very surprising response there.  That is definitely an internal exception that we shouldn't be sharing out to you.  Will need to look into this on our side.  Will update when we have more to share.

Dave Berard
Senior Product Manager, Constant Contact