Random errors with code 400

Regular Participant

Random errors with code 400

Hi,

 

When updating a contact's info/subscription using the API, sometimes I get the error:

 

Error 400: Update failed: Existing person 123456:789 has an invalid state: Status transition from O to S is not allowed when action by owner and confirm opt in is off

 

I'm guessing it's saying the user is being changed from Do Not Mail to Active and the action is by owner (ACTION_BY_CUSTOMER?).

 

However the xml posted has ACTION_BY_CONTACT specified.

 

This happens randomly (but quite frequent) as if I do the same update again, it would go through fine.

 

Thanks.

6 REPLIES 6
Regular Participant

Is there a way to prevent this error?

Moderator

Hey Jason,

 

I'd be interested to see the XML behind this, both the original state of the Contact, and what is being pushed for the update. This can definitely help with figuring out the cause.

Nick Galbraith
Support Engineer
Regular Participant

I just ran some more testing and the error popped again.

 

Here's the xml before the update, basically it was the xml returned from cosntantcontact by using the get detailed contact info http get.

 

?xml version="1.0" encoding="UTF-8" standalone="no"?<entry xmlns="http://www.w3.org/2005/Atom">
  <link href="/ws/customers/abc/contacts/238" rel="edit"/>
  <id>http://api.constantcontact.com/ws/customers/abc/contacts/238</id>
  <title type="text">Contact: xyz@xyz.com</title>
  <updated>2012-03-16T17:46:27.829Z</updated>
  <author>
    <name>Constant Contact</name>
  </author>
  <content type="application/vnd.ctct+xml">
    <Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/abc/contacts/238">
      <Status>Do Not Mail</Status>
      <EmailAddress>xyz@xyz.com</EmailAddress>
      <EmailType>HTML</EmailType>
      <Name> </Name>
      <FirstName/>
      <MiddleName/>
      <LastName/>
      <JobTitle/>
      <CompanyName/>
      <HomePhone/>
      <WorkPhone/>
      <Addr1/>
      <Addr2/>
      <Addr3/>
      <City/>
      <StateCode/>
      <StateName/>
      <CountryCode/>
      <CountryName/>
      <PostalCode/>
      <SubPostalCode/>
      <Note/>
      <CustomField1/>
      <CustomField2/>
      <CustomField3/>
      <CustomField4/>
      <CustomField5/>
      <CustomField6/>
      <CustomField7/>
      <CustomField8/>
      <CustomField9/>
      <CustomField10/>
      <CustomField11/>
      <CustomField12/>
      <CustomField13/>
      <CustomField14/>
      <CustomField15/>
      <Confirmed>true</Confirmed>
      <InsertTime>2012-03-12T17:52:48.386Z</InsertTime>
      <LastUpdateTime>2012-03-16T17:46:27.829Z</LastUpdateTime>
    </Contact>
  </content>
  <source>
    <id>http://api.constantcontact.com/ws/customers/abc/contacts</id>
    <title type="text">Contacts for Customer: abc</title>
    <link href="contacts"/>
    <link href="contacts" rel="self"/>
    <author>
      <name>abc</name>
    </author>
    <updated>2012-03-16T17:46:35.471Z</updated>
  </source>
</entry>

 

Below is the xml used to update this contact.

?xml version="1.0" encoding="UTF-8"?
<entry xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Contact: xyz@xyz.com</title>
  <id>http://api.constantcontact.com/ws/customers/abc/contacts/238</id>
  <author></author>
  <summary type="text">Update Contact</summary>
  <updated>2012-03-16T10:41:31.450Z</updated>
  <content type="application/vnd.ctct+xml">
    <Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/abc/contacts/238">
      <EmailAddress>xyz@xyz.com</EmailAddress>
      <StateCode></StateCode>
      <StateName></StateName>
      <CountryCode></CountryCode>
      <CountryName></CountryName>
      <OptInSource>ACTION_BY_CONTACT</OptInSource>
      <ContactLists>
        <ContactList id="http://api.constantcontact.com/ws/customers/abc/lists/2"></ContactList>
        <ContactList id="http://api.constantcontact.com/ws/customers/abc/lists/72"></ContactList>
      </ContactLists>
    </Contact>
  </content>
</entry>

 

If I run through the process again, it would work fine. Using the same xml pretty much.

 

Also, what does this error mean?

Error 400: Update failed: Existing person 123456:238 has an invalid state: Status transition from O to S is not allowed when action by owner and confirm opt in is off

 

[*Note from a CTCT Community Admin: I removed the beginning and ending brackets from the "?xml version="1.0"..." lines in your post above because those lines break the "Developer Support" tab in our CTCT "Labs JMML Q&A" Facebook app (apparently, the app is trying to render those lines as is, which wouldn't be acceptable in the middle of a page).]

Regular Participant

Hi, just wondering if this is being looked into.

Also are you able to reproduce this issue?

Hey, sorry for the lack of updates on this. I'm still trying to recreate on my end. Would you be able to PM me the username that you're working in, so I can make sure my account has all the same settings?

Nick Galbraith
Support Engineer
Regular Participant

Hi Nick,

 

Thanks for getting on it.  PM sent.

Developer Portal

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

Visit Page