We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Error 400: Errors in the common Atom sections

AndyH20
Participant

Error 400: Errors in the common Atom sections

A monthly campaign set of mine is not working, calls to update a campaign via, for example:

 

https://api.constantcontact.com/ws/customers/redacted/campaigns/1113798118549

 

Return a 400-code error:

Constant Contact HTTP Request Exception: Error 400: The request contains errors in the common Atom sections, which lie outside <entry> or <Content>, such as <feed>, <id>, <author> or <updated>.

 

I've tried to identify any kind of error in the XML but it appears valid, and if there is an problem with the content I cannot find it. The XML sent is as follows:

 

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
  <link href="/ws/customers/customer/campaigns" rel="edit"/>
  <id>http://api.constantcontact.com/ws/customers/redacted/campaigns/1113798118549</id>
  <title type="text">2013 Monthly Emails - 06/13</title>
  <updated>2009-10-19T18:34:53.105Z</updated>
  <author>
    <name>Constant Contact</name>
  </author>
  <content type="application/vnd.ctct+xml">
    <Campaign xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/redacted/campaigns/1113798118549">
      <Name>2013 Monthly Emails - 06/13</Name>
      <Status>draft</Status>
      <Date>2013-06-17T14:32:48.237Z</Date>
      <Subject>How to Remove Ketchup From Your Carpet</Subject>
      <FromName>Oxi Fresh</FromName>
      <ViewAsWebpage>NO</ViewAsWebpage>
      <ViewAsWebpageLinkText></ViewAsWebpageLinkText>
      <ViewAsWebpageText></ViewAsWebpageText>
      <PermissionReminder>YES</PermissionReminder>
      <PermissionReminderText></PermissionReminderText>
      <GreetingSalutation>1</GreetingSalutation>
      <GreetingName>FirstName</GreetingName>
      <GreetingString>Greetings!</GreetingString>
      <OrganizationName>redacted</OrganizationName>
      <OrganizationAddress1>143 Union Blvd</OrganizationAddress1>
      <OrganizationAddress2></OrganizationAddress2>
      <OrganizationAddress3></OrganizationAddress3>
      <OrganizationCity>Colorado Springs</OrganizationCity>
      <OrganizationState>CO</OrganizationState>
      <OrganizationInternationalState>Colorado</OrganizationInternationalState>
      <OrganizationCountry>us</OrganizationCountry>
      <OrganizationPostalCode>80912</OrganizationPostalCode>
      <IncludeForwardEmail>YES</IncludeForwardEmail>
      <ForwardEmailLinkText>Forward this email</ForwardEmailLinkText>
      <IncludeSubscribeLink>YES</IncludeSubscribeLink>
      <SubscribeLinkText>Subscribe Me!</SubscribeLinkText>
      <EmailContentFormat>HTML</EmailContentFormat>
      <EmailContent></EmailContent>
      <EmailTextContent>This email requires you use the HTML version to view its content.</EmailTextContent>
      <StyleSheet></StyleSheet>
      <ContactLists>
        <ContactList id="http://api.constantcontact.com/ws/customers/redacted/lists/2">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/redacted/lists/2" rel="self"/>
        </ContactList>
      </ContactLists>
      <FromEmail>
        <Email id="http://api.constantcontact.com/ws/customers/redacted/settings/emailaddresses/1">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/redacted/settings/emailaddresses/1" rel="self"/>
        </Email>
        <EmailAddress>redacted</EmailAddress>
      </FromEmail>
      <ReplyToEmail>
        <Email id="http://api.constantcontact.com/ws/customers/redacted/settings/emailaddresses/1">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/redacted/settings/emailaddresses/1" rel="self"/>
        </Email>
        <EmailAddress>redacted</EmailAddress>
      </ReplyToEmail>
    </Campaign>
  </content>
  <source>
    <id>http://api.constantcontact.com/ws/customers/redacted/campaigns/1113798118549</id>
    <title type="text">Campaigns for customer</title>
    <link href="campaigns"/>
    <link href="campaigns" rel="self"/>
    <author>
      <name>customer</name>
    </author>
    <updated>2013-06-19T11:52:11+01:00</updated>
  </source>
</entry>

 

Any help tracking this down would be appreciated. 

3 REPLIES 3
Shannon_W
Employee

Hi,

 

Recently, an update we made on our end caused this error to start happening when it wasn't previously.  I'm very sorry for the inconvenience.  This issue only appears to affect updating email campaigns that utilize Constant Contact templates (STOCK campaigns created while logged into the account).

 

Our engineers are working on fixing this issue, hopefully in the next few weeks.  Our V2 API doesn't have this issue (it uses JSON, not XML), so if you'd like to move over now, it would avoid the problem.  Here is documentation for email campaign management with the V2 API.  The process is very similar to the V1 API; you make a GET call to the campaign, modify it, and send back the modified campaign with a PUT request.

 

Best Regards,

Shannon W.

API Support Specialist

ramesht183
Occasional Participant

I am getting  error 400:errors in the common Atom sections.My php code is 

<?php


$method = strtoupper("Post");
$params=array();
$params['activityType'] = 'SV_ADD';
$params['data']='"Email Address" 1211qq@gmail.com 12111qq@gmail.com 11121qq@gmail.com 11131qq@gmail.com 11131qq@gmail.com 11511qq@gmail.com 11141qq@gmail.com 11161qq@gmail.com 11171qq@gmail.com 11181qq@gmail.com 11191qq@gmail.com 111121qq@gmail.com 1110331qq@gmail.com 1111231qq@gmail.com 11134341qq@gmail.com 1111545qq@gmail.com 1153411qq@gmail.com 1154511qq@gmail.com 1145511qq@gmail.com 117454d11qq@gmail.com 1177711qq@gmail.com 1118901qq@gmail.com 1110981qq@gmail.com 111451qq@gmail.com 1134311qq@gmail.com 122122@gmail.com 13457@gmail.com 1689@gmail.com';
$params['lists']='https://api.constantcontact.com/ws/customers/UN/lists/2015902194';
$session = curl_init('https://api.constantcontact.com/ws/customers/UN/activities');
curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($session, CURLOPT_USERPWD, "key%usernamepassword");
curl_setopt($session, CURLOPT_POST, 1);
curl_setopt($session, CURLOPT_POSTFIELDS , $params);
curl_setopt($session, CURLOPT_HTTPHEADER, Array("Content-Type:application/atom+xml"));
curl_setopt($session, CURLOPT_HEADER, false); // Do not return headers
curl_setopt($session, CURLOPT_RETURNTRANSFER, 1); // If you set this to 0, it will take you to a page with the
$response = curl_exec($session);
print_r($response);
curl_close($session);

 

?>
for try purpose i used dummy email address and username i given as Un.can anyone help me to findout what i am doing wrong??

Hello @ramesht183,

 

Thank you for reaching out to Constant Contact's API Support.

 

It looks like you are using our v1 API endpoints. That version of the API still works, but is considered deprecated. Is there any particular reason you are trying to use it and not using our current v2 API?

 

I would suggest moving to the v2 API and using those endpoints. Here is a link to the documentation: http://developer.constantcontact.com/docs/developer-guides/overview-of-api-endpoints.html


Regards,
Jimmy D.
Tier II API Support Engineer
Developer Portal

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

Visit Page