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: Entry has invalid root null

Highlighted
Member

Error 400: Entry has invalid root null

I testing out the API. I am using RESTClient 2.3.3. I have had success in creating a contact, retrieving lists, etc. Now I am trying to test opt-in for a contact (me!) who has been removed from all lists (i.e. on the Removed list). Here's what I am doing:

 

Method: put

Header: Content-Type value=application/atom+xml

URL: https://api.constantcontact.com/ws/customers/cofl32/contacts/665  (contact id found by doing a GET on email addr, so I know it is correct)

Body: (with userid and email address obfuscated)

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns=" http://www.w3.org/2005/Atom">
  <id>http://api.constantcontact.com/ws/customers/******/contacts/665</id>
  <title type="text">Contact: testuser@gmail.com</title>
  <updated>2011-04-25T10:07:06.096Z</updated>
  <author></author>
  <content type="application/vnd.ctct+xml">
    <Contact xmlns=" http://ws.constantcontact.com/ns/1.0/" id=" http://api.constantcontact.com/ws/customers/******/contacts/665">
      <EmailAddress>testuser@gmail.com</EmailAddress>
      <OptInSource>ACTION_BY_CONTACT</OptInSource>
      <ContactLists>
        <ContactList id="http://api.constantcontact.com/ws/customers/******/lists/2"></ContactList>
        <ContactList id=" http://api.constantcontact.com/ws/customers/******/lists/4"></ContactList>
        <ContactList id=" http://api.constantcontact.com/ws/customers/******/lists/8"></ContactList>
        <ContactList id=" http://api.constantcontact.com/ws/customers/******/lists/5"></ContactList>
      </ContactLists>
    </Contact>
  </content>
</entry>

 

What am I doing wrong here?

2 REPLIES 2
Highlighted
Member

Re: Error 400: Entry has invalid root null

Since no one found this interesting enough to comment on, I thought I would just answer it myself. The problems was mal-formed, inadequaate XML in the Body. Once I got the body XML correct, it updated to contact status to 'active' from 'removed' and added it to the designated email lists. Note that I still don't understand the "invalid root null" message in my case, but he updated XML that works looks like this:

 

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
  <link href="/ws/customers/{username}/contacts/665" rel="edit"/>
  <id>http://api.constantcontact.com/ws/customers/{username}/contacts/665</id>
  <title type="text">Contact: testuser@gmail.com</title>
  <updated>2011-04-25T13:07:06.096Z</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/{username}/contacts/665">
      <Status>Active</Status>
      <EmailAddress>testuser@gmail.com</EmailAddress>
      <EmailType>HTML</EmailType>
      <Name>Brewer, Paul</Name>
      <OptInTime>2011-04-24T22:32:39.251Z</OptInTime>
      <OptInSource>ACTION_BY_CONTACT</OptInSource>
      <ContactLists>
        <ContactList id="http://api.constantcontact.com/ws/customers/{username}/lists/2"></ContactList>
        <ContactList id=" http://api.constantcontact.com/ws/customers/{username}/lists/4"></ContactList>
        <ContactList id=" http://api.constantcontact.com/ws/customers/{username}/lists/8"></ContactList>
        <ContactList id=" http://api.constantcontact.com/ws/customers/{username}/lists/5"></ContactList>
      </ContactLists>
    </Contact>
  </content>
</entry>

Highlighted
Employee

Re: Error 400: Entry has invalid root null

I apologize for not responding sooner. We do our best to answer as quickly as possible but are not always available, I am glad you were able to figure out the problem though. The error you were receiving regarding the invalid root null is pertaining to the space you had in your entry node between the first quote and the http://www.w3.org/2005/Atom.

 

If you have any other questions please feel free to post and we'll be happy to help. Thanks!

David J

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