Between 9pm - 11pm ET this Sat (9/18), we will be doing routine network maintenance. Please avoid usage of our API during this time frame - including any scheduled sync jobs. Thank you in advance for your patience.

ERROR 400 when POSTING a campaign

johnf7261
Participant

ERROR 400 when POSTING a campaign

Hi

 

I regularly GET, change and then POST changes to campaign <ContactList> associates. But I'm bow getting this error via the API:

 

"

Error 400: Error: Line 6: cvc-complex-type.2.4.a: Invalid content was found starting with element LastRunDate. One of {"http://ws.constantcontact.com/ns/1.0/":PermissionReminder, "http://ws.constantcontact.com/ns/1.0/":PermissionReminderText, "http://ws.constantcontact.com/ns/1.0/":Subject, "http://ws.constantcontact.com/ns/1.0/":FromName, "http://ws.constantcontact.com/ns/1.0/":ViewAsWebpage, "http://ws.constantcontact.com/ns/1.0/":ViewAsWebpageLinkText, "http://ws.constantcontact.com/ns/1.0/":ViewAsWebpageText, "http://ws.constantcontact.com/ns/1.0/":ProductID, "http://ws.constantcontact.com/ns/1.0/":ShowAgent, "http://ws.constantcontact.com/ns/1.0/":LetterImageList, "http://ws.constantcontact.com/ns/1.0/":Sent, "http://ws.constantcontact.com/ns/1.0/":Opens, "http://ws.constantcontact.com/ns/1.0/":Clicks, "http://ws.constantcontact.com/ns/1.0/":Bounces, "http://ws.constantcontact.com/ns/1.0/":Forwards, "http://ws.constantcontact.com/ns/1.0/":OptOuts, "http://ws.constantcontact.com/ns/1.0/":SpamReports, "http://ws.constantcontact.com/ns/1.0/":CampaignType, "http://ws.constantcontact.com/ns/1.0/":EmailContent, "http://ws.constantcontact.com/ns/1.0/":EmailTextContent, "http://ws.constantcontact.com/ns/1.0/":EmailContentFormat, "http://ws.constantcontact.com/ns/1.0/":StyleSheet, "http://ws.constantcontact.com/ns/1.0/":ContactLists, "http://ws.constantcontact.com/ns/1.0/":FromEmail, "http://ws.constantcontact.com/ns/1.0/":ReplyToEmail, "http://ws.constantcontact.com/ns/1.0/":GreetingSalutation, "http://ws.constantcontact.com/ns/1.0/":GreetingName, "http://ws.constantcontact.com/ns/1.0/":GreetingString, "http://ws.constantcontact.com/ns/1.0/":OrganizationName, "http://ws.constantcontact.com/ns/1.0/":OrganizationAddress1, "http://ws.constantcontact.com/ns/1.0/":OrganizationAddress2, "http://ws.constantcontact.com/ns/1.0/":OrganizationAddress3, "http://ws.constantcontact.com/ns/1.0/":OrganizationCity, "http://ws.constantcontact.com/ns/1.0/":OrganizationState, "http://ws.constantcontact.com/ns/1.0/":OrganizationInternationalState, "http://ws.constantcontact.com/ns/1.0/":OrganizationPostalCode, "http://ws.constantcontact.com/ns/1.0/":OrganizationCountry, "http://ws.constantcontact.com/ns/1.0/":IncludeForwardEmail, "http://ws.constantcontact.com/ns/1.0/":ForwardEmailLinkText, "http://ws.constantcontact.com/ns/1.0/":IncludeSubscribeLink, "http://ws.constantcontact.com/ns/1.0/":SubscribeLinkText, "http://ws.constantcontact.com/ns/1.0/":ArchiveStatus, "http://ws.constantcontact.com/ns/1.0/":ArchiveURL, "http://ws.constantcontact.com/ns/1.0/":SharePageURL, "http://ws.constantcontact.com/ns/1.0/":NextRunDate, "http://ws.constantcontact.com/ns/1.0/":Urls} is expected.

"

 

I POST this :

 

<entry xmlns="http://www.w3.org/2005/Atom">
<link href="/ws/customers/accesscc%40hotmail.com/campaigns/1112466035357" rel="edit" />
<id>http://api.constantcontact.com/ws/customers/accesscc%40hotmail.com/campaigns/1112466035357</id>
<title type="text">Access Campaign 2</title>
<updated>2013-02-14T13:58:56.573Z</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/accesscc%40hotmail.com/campaigns/1112466035357">
<Name>Access Campaign 2</Name>
<Status>Draft</Status>
<Date>2013-02-14T13:58:56.573Z</Date>
<LastEditDate>2013-02-14T13:58:56.573Z</LastEditDate>
<Sent>0</Sent>
<Opens>0</Opens>
<Clicks>0</Clicks>
<Bounces>0</Bounces>
<Forwards>0</Forwards>
<OptOuts>0</OptOuts>
<SpamReports>0</SpamReports>
<SharePageURL>http://myemail.constantcontact.com/.html?soid=1112299411627&amp;aid=xE8apQPflQs</SharePageURL>
<Subject>Enter Subject line here.</Subject>
<FromName>[Your Company Name]</FromName>
<CampaignType>STOCK</CampaignType>
<ViewAsWebpage>YES</ViewAsWebpage>
<ViewAsWebpageLinkText>Having trouble viewing this email?</ViewAsWebpageLinkText>
<ViewAsWebpageText>Click here</ViewAsWebpageText>
<PermissionReminder>YES</PermissionReminder>
<PermissionReminderText>Hi, just a reminder that youre receiving this email because you have expressed an interest in [Your Company Name]. Dont forget to add ccaccess@hotmail.com to your address book so well be sure to land in your inbox!</PermissionReminderText>
<GreetingSalutation />
<GreetingString />
<OrganizationName>[Your Company Name]</OrganizationName>
<OrganizationAddress1>10 eastcheap</OrganizationAddress1>
<OrganizationAddress2>test</OrganizationAddress2>
<OrganizationAddress3>test account</OrganizationAddress3>
<OrganizationCity>london</OrganizationCity>
<OrganizationState />
<OrganizationInternationalState>england</OrganizationInternationalState>
<OrganizationCountry>gb</OrganizationCountry>
<OrganizationPostalCode>nn137ab</OrganizationPostalCode>
<IncludeForwardEmail>YES</IncludeForwardEmail>
<ForwardEmailLinkText>Forward this email</ForwardEmailLinkText>
<IncludeSubscribeLink>YES</IncludeSubscribeLink>
<SubscribeLinkText>Subscribe Me!</SubscribeLinkText>
<ArchiveStatus />
<ArchiveURL />
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/accesscc%40hotmail.com/lists/10">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/accesscc%40hotmail.com/lists/10" rel="self" />
</ContactList>
<ContactList id="http://api.constantcontact.com/ws/customers/accesscc%40hotmail.com/lists/12">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/accesscc%40hotmail.com/lists/12" rel="self" />
</ContactList>
<ContactList id="http://api.constantcontact.com/ws/customers/accesscc%40hotmail.com/lists/6">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/accesscc%40hotmail.com/lists/6" rel="self" />
</ContactList>
</ContactLists>
<FromEmail>
<Email id="http://api.constantcontact.com/ws/customers/accesscc%40hotmail.com/settings/emailaddresses/2">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/accesscc%40hotmail.com/settings/emailaddresses/2" rel="self" />
</Email>
<EmailAddress>ccaccess@hotmail.com</EmailAddress>
</FromEmail>
<ReplyToEmail>
<Email id="http://api.constantcontact.com/ws/customers/accesscc%40hotmail.com/settings/emailaddresses/2">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/accesscc%40hotmail.com/settings/emailaddresses/2" rel="self" />
</Email>
<EmailAddress>ccaccess@hotmail.com</EmailAddress>
</ReplyToEmail>
</Campaign>
</content>
<source>
<id>http://api.constantcontact.com/ws/customers/accesscc%40hotmail.com/campaigns</id>
<title type="text">Campaigns for customer: accesscc@hotmail.com</title>
<link href="campaigns" />
<link href="campaigns" rel="self" />
<author>
<name>accesscc@hotmail.com</name>
</author>
<updated>2013-03-07T17:37:25.565Z</updated>
</source>
</entry>

 

Any idea?????????

3 REPLIES 3
Shannon_W
Employee

Hi,

 

Can you successfully GEt and then PUT the information back without making changes successfully?  I normally don't encode @ symbols in nodes referencing the username; try replacing %40 with @ in any url's that reference your username (which has an @ in it since it's an email address).

 

Best Regards,

Shannon W.

API Support Specialist

The GET encodes the @ in the username....

Hi,

 

Can you do a GET and then PUT the same payload back in successfully without making changes?  That will help rule out an encoding issue.

 

Best Regards,

Shannon W.

API Support Specialist

Developer Portal

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

Visit Page