400 error on Campaign Interaction

Regular Participant

400 error on Campaign Interaction

I was wondering if anybody had any insight as to what might be causing the 400 error to be triggered when i send the following:
I have obviously replaced my login with "USER_NAME"



URI: https://api.constantcontact.com/ws/customers/USER_NAME/campaigns
HEADER:
CODE: 400
ERROR: The requested URL returned error: 400
PARAM:
<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom">
<link href="/ws/customers/USER_NAME/campaigns" rel="edit" />
<id>http://api.constantcontact.com/ws/customers/USER_NAME/campaigns</id>
<title type="text">2011</title>
<updated>2011-03-07T16:34:53.105Z</updated>
<author>
<name>Gaston</name>
</author>
<content type="application/vnd.ctct.xml">
<Campaign xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/USER_NAME/campaigns/1100546096289">
<Name>2011</Name>
<Status>Draft</Status>
<Date>2009-10-19T18:34:53.105Z</Date>
<Subject>Car.com - New Auto Loan Request</Subject>
<FromName>autoloan@callcentercar.com</FromName>
<ViewAsWebpage>NO</ViewAsWebpage>
<ViewAsWebpageLinkText></ViewAsWebpageLinkText>
<ViewAsWebpageText></ViewAsWebpageText>
<PermissionReminder>NO</PermissionReminder>
<PermissionReminderText>
</PermissionReminderText>
<GreetingSalutation>Dear</GreetingSalutation>
<GreetingName>FirstName</GreetingName>
<GreetingString>Greetings!</GreetingString>
<OrganizationName>ctct</OrganizationName>
<OrganizationAddress1>123 wsw st</OrganizationAddress1>
<OrganizationAddress2></OrganizationAddress2>
<OrganizationAddress3></OrganizationAddress3>
<OrganizationCity>Ashland</OrganizationCity>
<OrganizationState>MA</OrganizationState>
<OrganizationInternationalState></OrganizationInternationalState>
<OrganizationCountry>us</OrganizationCountry>
<OrganizationPostalCode>32423</OrganizationPostalCode>
<IncludeForwardEmail>NO</IncludeForwardEmail>
<ForwardEmailLinkText></ForwardEmailLinkText>
<IncludeSubscribeLink>NO</IncludeSubscribeLink>
<SubscribeLinkText></SubscribeLinkText>
<EmailContentFormat>HTML</EmailContentFormat>
<EmailContent>&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
tracy,&lt;br&gt;&lt;br&gt;
Per our discussion, here is the information on financing for your next vehicle purchase.&lt;br&gt;&lt;br&gt;
Please follow this link to apply now and see if you qualify to take advantage of this program:&lt;br&gt;&lt;br&gt;
&lt;a href="https://finance.car.com/index.cfm?action=sp&amp;src=3073155"&gt;https://finance.car.com/index.cfm?action=sp&amp;src=3073155&lt;/a&gt;&lt;br&gt;&lt;br&gt;
I appreciate your time and consideration.  Please let us know if there is anything we can help you with.&lt;br&gt;&lt;br&gt;
606 - Gershom Stroud&lt;br&gt;&lt;br&gt;
&lt;a href="mailto:Financehelp@car.com"&gt;Financehelp@car.com'&lt;/a&gt;&lt;br&gt;&lt;br&gt;
p.s. you can manage your email preferences at car.com using the following link: http://finance.car.com/subscribe&lt;br&gt;&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;</EmailContent>
<EmailTextContent>text</EmailTextContent>
<StyleSheet></StyleSheet>
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/USER_NAME/lists/16665">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/USER_NAME/lists/16665" rel="self"/>
</ContactList>
</ContactLists>
<FromEmail>
<Email id="http://api.constantcontact.com/ws/customers/USER_NAME/settings/emailaddresses/3">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/USER_NAME/settings/emailaddresses/1" rel="self" />
</Email>
<EmailAddress>autoloan@callcentercar.com</EmailAddress>
</FromEmail>
<ReplyToEmail>
<Email id="http://api.constantcontact.com/ws/customers/USER_NAME/settings/emailaddresses/3">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/USER_NAME/settings/emailaddresses/1" rel="self" />
</Email>
<EmailAddress>autoloan@callcentercar.com</EmailAddress>
</ReplyToEmail>
</Campaign>
</content>
<source>
<id>http://api.constantcontact.com/ws/customers/USER_NAME/campaigns</id>
<title type="text">Campaigns for customer: USER_NAME</title>
<link href="campaigns" />
<link href="campaigns" rel="self" />
<author>
<name>Gaston</name>
</author>
<updated>2011-03-07T16:34:53.105Z</updated>
</source>
</entry>

7 REPLIES 7
Employee

Hey Pat,

 

I am not seeing any thing wrong with your code except that the  <EmailTextContent> node should have some more information.

 

 <EmailTextContent>&lt;Text&gt;&lt;Greeting/&gt;&lt;/Text&gt;</EmailTextContent>

 If that does not fix this please do a get to your URI and let me know what comes back.

Ryan Davis
Quality Engineer
Regular Participant

Hey Ryan!

Thanks for the quick response. I modifed the "EmailTextContent" as you suggested but i am still getting a 400 error when submitting my request.

Doing a "GET", returns a 200 code with an XML payload. 

 

Thanks for your assistance

Problem is the <content> node type attribute.  You have:

 

<content type="application/vnd.ctct.xml">

 

It should be:

 

<content type="application/vnd.ctct+xml">

 

Changing that should get you passed the 400 error.

Dave Berard
Senior Product Manager, Constant Contact
Regular Participant

Hi Dave,

I have modified the <content> node as you specified. I am still getting a 400 error. For the life of me i cant figure out what im doing wrong.Do you have any insight?

 

URI: https://api.constantcontact.com/ws/customers/patkunnect/campaigns
HEADER:
PAYLOAD:
INFO: Array
CODE: 400
ERROR: The requested URL returned error: 400
PARAM:

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom">
<link href="/ws/customers/patkunnect/campaigns" rel="edit" />
<id>http://api.constantcontact.com/ws/customers/patkunnect/campaigns</id>
<title type="text">New_Loan_Campaign 7 at 2011-08-11T14:59:50</title>
<updated>2011-08-11T14:59:50.105Z</updated>
<author>
<name>Gaston</name>
</author>
<content type="application/vnd.ctct+xml">
<Campaign xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/patkunnect/campaigns/1100546096289">
<Name>New_Loan_Campaign 7 at 2011-08-11T14:59:50</Name>
<Status>Draft</Status>
<Date2011-08-11T14:59:50.105Z</Date>
<Subject>Car.com - New Auto Loan Request</Subject>
<FromName>autoloan@callcentercar.com</FromName>
<ViewAsWebpage>NO</ViewAsWebpage>
<ViewAsWebpageLinkText></ViewAsWebpageLinkText>
<ViewAsWebpageText></ViewAsWebpageText>
<PermissionReminder>NO</PermissionReminder>
<PermissionReminderText>
</PermissionReminderText>
<GreetingSalutation>Dear</GreetingSalutation>
<GreetingName>FirstName</GreetingName>
<GreetingString>Greetings!</GreetingString>
<OrganizationName>ctct</OrganizationName>
<OrganizationAddress1>123 wsw st</OrganizationAddress1>
<OrganizationAddress2></OrganizationAddress2>
<OrganizationAddress3></OrganizationAddress3>
<OrganizationCity>Ashland</OrganizationCity>
<OrganizationState>MA</OrganizationState>
<OrganizationInternationalState></OrganizationInternationalState>
<OrganizationCountry>us</OrganizationCountry>
<OrganizationPostalCode>32423</OrganizationPostalCode>
<IncludeForwardEmail>NO</IncludeForwardEmail>
<ForwardEmailLinkText></ForwardEmailLinkText>
<IncludeSubscribeLink>NO</IncludeSubscribeLink>
<SubscribeLinkText></SubscribeLinkText>
<EmailContentFormat>HTML</EmailContentFormat>
<EmailContent>&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
tracy,&lt;br&gt;&lt;br&gt;
Per our discussion, here is the information on financing for your next vehicle purchase.&lt;br&gt;&lt;br&gt;
Please follow this link to apply now and see if you qualify to take advantage of this program:&lt;br&gt;&lt;br&gt;
&lt;a href="https://finance.car.com/index.cfm?action=sp&amp;src=3073155"&gt;https://finance.car.com/index.cfm?action=sp&amp;src=3073155&lt;/a&gt;&lt;br&gt;&lt;br&gt;
I appreciate your time and consideration.  Please let us know if there is anything we can help you with.&lt;br&gt;&lt;br&gt;
606 - Gershom Stroud&lt;br&gt;&lt;br&gt;
&lt;a href="mailto:Financehelp@car.com"&gt;Financehelp@car.com'&lt;/a&gt;&lt;br&gt;&lt;br&gt;
p.s. you can manage your email preferences at car.com using the following link: http://finance.car.com/subscribe&lt;br&gt;&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;</EmailContent>
<EmailTextContent>&lt;Text&gt;&lt;Greeting/&gt;&lt;/Text&gt;</EmailTextContent>
<StyleSheet></StyleSheet>
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/patkunnect/lists/60">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/patkunnect/lists/60" rel="self"/>
</ContactList>
</ContactLists>
<FromEmail>
<Email id="http://api.constantcontact.com/ws/customers/patkunnect/settings/emailaddresses/1">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/patkunnect/settings/emailaddresses/1" rel="self" />
</Email>
<EmailAddress>autoloan@callcentercar.com</EmailAddress>
</FromEmail>
<ReplyToEmail>
<Email id="http://api.constantcontact.com/ws/customers/patkunnect/settings/emailaddresses/1">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/patkunnect/settings/emailaddresses/1" rel="self" />
</Email>
<EmailAddress>autoloan@callcentercar.com</EmailAddress>
</ReplyToEmail>
</Campaign>
</content>
<source>
<id>http://api.constantcontact.com/ws/customers/patkunnect/campaigns</id>
<title type="text">Campaigns for customer: patkunnect</title>
<link href="campaigns" />
<link href="campaigns" rel="self" />
<author>
<name>Gaston</name>
</author>
<updated>2011-08-11T14:59:50.105Z</updated>
</source>
</entry>

There is a typo in the second set of XML that wasn't in the first that is causing the 400 when I try to run the XML:

 

 <Date2011-08-11T14:59:50.105Z</Date>

 

Should be:

 

<Date>2011-08-11T14:59:50.105Z</Date>

 

The missing > on the <Date> node was causing the error.  Fixing that allowed me to create the campaign in my account.

Dave Berard
Senior Product Manager, Constant Contact
Regular Participant

Doh! Thanks alot Dave! Works perfectly now.

Im hoping this is my last question. =)

 

So now i have created an Email Campaign and i want to schedule it.

I get a 403 error when i try to submit. I am assuming that i am not currently allowed to schedule.

 

URI: https://api.constantcontact.com/ws/customers/patkunnect/campaigns/1107066789602/schedules
CODE: 403
ERROR: The requested URL returned error: 403
PARAM:

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom">
<link href="/ws/customers/patkunnect/campaigns/1107066789602/schedules/1" rel="edit" />
<id>http://api.constantcontact.com/ws/customers/patkunnect/campaigns/1107066789602/schedules/1</id>
<title type="text">2010-11-13T15:03:35Z</title>
<updated>2010-11-13T20:03:35.000Z</updated>
<author> <name>Constant Contact</name> </author>
<content type="application/vnd.ctct+xml">
<Schedule xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/patkunnect/campaigns/1107066789602/schedules/1">
<ScheduledTime>2011-08-11T15:20:23</ScheduledTime>
</Schedule> </content> </entry>

You guys are extremely helpful AND fast. Really appreciated =)

Looks like that is 100% correct, you'll just need to send a request to get access to Scheduling API access to appconnect@constantcontact.com.  Once you get the request in, it takes 1-2 days for our team to process your request and make sure we can provide access.  It is a private access only API so we do require that all requests go through our official channels.

 

If you already submitted your request, and I didn't see it when I just checked, you should hear back from us soon.

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page