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.

Error 400 Bad request updating a contact

Highlighted
New Member

Error 400 Bad request updating a contact

Hi,

We have an old development based on the .NET wrapper library of Constant Contact's V1 API that has been succesfully working for several months. But, since about from 2013-11-20, we are getting an error when attempting to update a contact.

The code we're using with your wrapper is as follows:

 

Contact xContactTemp = Utility.GetContactDetailsById(AuthenticationData, xContactList[0].Id);

if (xContactTemp.ContactLists.Count > 0 )
{
    xContactTemp.ContactLists.Clear();
    xContactTemp.Status = ContactStatus.Removed;
    Utility.UpdateContactFullForm(AuthenticationData, xContactTemp);
}

 

The UpdateContactFullForm function throws an exception error 400 Bad request. The XML that is generated from the UpdateContactFullForm function is as follows:

 

<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/*username*/contacts/*idcontact*</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/*username*/contacts/*idcontact*">
      <EmailAddress>mail@mail.com</EmailAddress>
      <FirstName>FirstName</FirstName>
      <LastName></LastName>
      <MiddleName></MiddleName>
      <OptInSource>ACTION_BY_CONTACT</OptInSource>
      <HomePhone></HomePhone>
      <Addr1></Addr1>
      <Addr2></Addr2>
      <Addr3></Addr3>
      <City>City</City>
      <StateCode></StateCode>
      <StateName></StateName>
      <CountryCode></CountryCode>
      <CountryName></CountryName>
      <PostalCode></PostalCode>
      <SubPostalCode></SubPostalCode>
      <EmailType>HTML</EmailType>
      <WorkPhone></WorkPhone>
      <JobTitle></JobTitle>
      <CompanyName></CompanyName>
      <Note></Note>
      <CustomField1></CustomField1>
      <CustomField2>Seleccione Opci&#243;n</CustomField2>
      <CustomField3></CustomField3>
      <CustomField4></CustomField4>
      <CustomField5>192.168.0.10</CustomField5>
      <CustomField6></CustomField6>
      <CustomField7></CustomField7>
      <CustomField8></CustomField8>
      <CustomField9></CustomField9>
      <CustomField10></CustomField10>
      <CustomField11></CustomField11>
      <CustomField12></CustomField12>
      <CustomField13></CustomField13>
      <CustomField14></CustomField14>
      <CustomField15></CustomField15>
      <ContactLists></ContactLists>
    </Contact>
  </content>
</entry>

  I've validated the XML structure and seems to be correct but I'm still getting the 400 Bad request response.
 
 Has anything changed recently?  Any idea about it?
 
 Any assistance would be greatly appreciated.
 
 Thanks in advance.

2 REPLIES 2
Highlighted
Moderator

Re: Error 400 Bad request updating a contact

Looks like the problem is you are attempting to Remove a Contact using ACTION_BY_CONTACT.  If you change this to ACTION_BY_CUSTOMER, the 400 error will go away. 

 

The reason that this looks to no longer be succeeding as a call when it did previously is that your account is using our new Contact Management system.  In that system, it is no longer a valid state transition to remove a Contact from all lists using ACTION_BY_CONTACT as the request method.  We are looking into this to make sure this is an intentional change and will update once we find additional information from our Contact Management team.  It's likely that we fixed an unintentional defect, which was allowing the API to accept this state transition in the first place as there are not many use cases where a Contact would want to change their subscription to no lists but not be moved to the Do Not Mail list (this is the deleteContact() method). 

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Visitor

Re: Error 400 Bad request updating a contact

Hi,

 

After apply this fix, we don't get the error, good.

 

But there is an unexpected behavior compared with the previous behavior, the account owner receives an email notification of the "change of interest",

 

Is this the expected behavior?

How could we avoid sending this email?

 

The email sent automatically looks like this:

 

 

Change of Interests

 

 

Dear **account name**,

We have recorded your changed interest preferences in our database. Please review your changes below:

No Interests

If these changes are not correct, please select the link at the bottom of this email to return to our Subscription Center and make the appropriate adjustments. In the future, the emails we send to you will reflect these changes.

Thank you for your continued interest in **Company**. Please feel free to contact us if you have any questions or comments.

Thank you,


 

 

 

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