cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Campaign using JAVA giving : Response status :HTTP/1.1 400 Bad Request

SOLVED
Occasional Contributor

Re: Creating Campaign using JAVA giving : Response status :HTTP/1.1 400 Bad Request

I am using multiple contacts in the campaigns I am scheduling. In the emails Content I need to put the details Names of the person who ever is receiving the Campaign email.

 

Eg In a campaign there are two contacts

     1, x@yyyy.com (First Name xxxx, Last Name yyyyy)

     2. b@abc.com(First Name AAAAA, Last Name BBBB)

 

I am creating contactList with the contacts

 

When the email is received by the receiver he/she should have the email contant as Dear <First Name> <Last Name>

 

I am able to send a standard format to all the contact mentioned in the campaign.

 

I there a way to personalize the email content based on the contacts?

 

 

 

Moderator

Re: Creating Campaign using JAVA giving : Response status :HTTP/1.1 400 Bad Request

If you're using one of our standard templates through our editor, you can find out how to add personalization here: http://constantcontact.custhelp.com/app/answers/detail/a_id/2069/kw/insert%20contact%20detail/r_id/1...

 

If you're using your own custom HTML code, it's a bit more complicated since you'll have to use XHTML merge tags.  We have a great guide to these advanced features here: http://img.constantcontact.com/docs/pdf/building-your-emails-with-the-advanced-editor-tool-constant-...

Dave Berard
Senior Product Manager, Constant Contact
Occasional Contributor

Re: Creating Campaign using JAVA giving : Response status :HTTP/1.1 400 Bad Request

I have tried to customise the email content in a email campaign as below. but I have not find the firstName of the contact in the email content. Please let me know what updations I need to do for the request

 

I have added the FirstName and LastName attributes to the contact used in this campaign

 

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<link href="/ws/customers/[removed my moderator]/campaigns" rel="edit"/>
<id>http://api.constantcontact.com/ws/customers/[removed my moderator]/campaigns</id>
<title type="text">API Test r Email 2012-08-14T14:44:49.970Z</title>
<updated>2012-08-14T14:44:49.970Z</updated>
<author>
<name>Constant </name>
</author>
<content type="application/vnd.ctct+xml">
<Campaign xmlns="http://ws.constantcontact.com/ns/1.0/"
id="http://api.constantcontact.com/ws/customers/[removed my moderator]
/campaigns/1111122233">
<Name>ShipcarsNow CTCT Campaign 2012-08-14T14:44:49.970Z</Name>
<Status>Draft</Status>
<Date>2012-08-14T14:44:49.970Z</Date>
<Subject>ShipCarsNow Test</Subject>
<FromName>ShipCarsNow Test</FromName>
<ViewAsWebpage>NO</ViewAsWebpage>
<ViewAsWebpageLinkText/>
<ViewAsWebpageText/>
<PermissionReminder>YES</PermissionReminder>
<PermissionReminderText>
You're receiving this email because of your relationship with ctct. Please
&lt;ConfirmOptin>&lt;a style="color:#0000ff;">confirm&lt;/a>&lt;/ConfirmOptin>
your continued interest in receiving email from us.
</PermissionReminderText>
<GreetingSalutation>Dear</GreetingSalutation>
<GreetingName>FirstName</GreetingName>
<GreetingString>Greetings!</GreetingString>
<OrganizationName>ShipCarsnow</OrganizationName>
<OrganizationAddress1>123 wsw st</OrganizationAddress1>
<OrganizationAddress2/>
<OrganizationAddress3/>
<OrganizationCity>OMAHA</OrganizationCity>
<OrganizationState>NE</OrganizationState>
<OrganizationInternationalState/>
<OrganizationCountry>US</OrganizationCountry>
<OrganizationPostalCode>32423</OrganizationPostalCode>
<IncludeForwardEmail>NO</IncludeForwardEmail>
<ForwardEmailLinkText/>
<IncludeSubscribeLink>NO</IncludeSubscribeLink>
<SubscribeLinkText/>
<EmailContentFormat>HTML</EmailContentFormat>
<EmailContent>&lt;html lang=&quot;en&quot; xml:lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
 xmlns:cctd=&quot;http://www.constantcontact.com/cctd&quot;&gt;
 &lt;body topmargin=&quot;0&quot; leftmargin=&quot;0&quot; rightmargin=&quot;0&quot;&gt;
  &lt;Greeting /&gt;
  &lt;br /&gt;
  &lt;CopyRight&gt;Copyright (c) 1996-2009 Constant Contact. All
   rights
   reserved. Except as permitted under a separate written agreement
   with Constant Contact, neither the Constant Contact software, nor
   any content that appears on any Constant Contact site, including
   but not limited to, web pages, newsletters, or templates may be
   reproduced, republished, repurposed, or distributed without the
   prior written permission of Constant Contact. For inquiries
   regarding reproduction or distribution of any Constant Contact
   material, please contact [removed my moderator].
    &lt;/CopyRight&gt;
  &lt;OpenTracking /&gt;
  &lt;!--
   Do NOT delete previous line if you want to get statistics on the
   number of opened emails
  --&gt;
  &lt;Greeting /&gt;
  &lt;CustomBlock name=&quot;letter.intro&quot; title=&quot;Personalization&quot;&gt;
   &lt;table style=&quot;background-color:#FFFFFF;&quot; bgcolor=&quot;#FFFFFF&quot;
    border=&quot;0&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;1&quot;&gt;
    &lt;tr&gt;
    &lt;td width=&quot;100%&quot;  rowspan=&quot;1&quot; colspan=&quot;1&quot; align=&quot;center&quot;&gt;
    &lt;table style=&quot;width:600px;&quot; border=&quot;0&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;    
    &lt;/table&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td rowspan=&quot;1&quot; colspan=&quot;1&quot; align=&quot;center&quot;&gt;
    &lt;table style=&quot;width:600px;border-color:#E4E4E4;border-width:1px;border-style:solid;&quot;
     border=&quot;0&quot; bordercolor=&quot;#E4E4E4&quot; width=&quot;600&quot; cellspacing=&quot;0&quot;
     cellpadding=&quot;0&quot;&gt;
    &lt;tr&gt;
    &lt;td width=&quot;100%&quot; rowspan=&quot;1&quot; colspan=&quot;1&quot;&gt;
    
    &lt;table border=&quot;0&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;5&quot; id=&quot;content_LETTER.BLOCK3&quot;&gt;
    &lt;tr&gt;
    &lt;td style=&quot;color:#555555;font-family:Arial,Helvetica,sans-serif;font-size:10pt;text-align: left;&quot;
     rowspan=&quot;1&quot; colspan=&quot;1&quot; align=&quot;left&quot;&gt;
    &lt;b&gt;Dear Customer,&lt;Greeting /&gt;&lt;/b&gt;
    &lt;br /&gt;
    &lt;br /&gt;    
    &lt;div&gt;
    &lt;p&gt;
    As an important customer of ShipCarsNow, we would appreciate it if you would take a few minutes to answer 10 brief questions
    about your satisfaction with our service over the past year. We will use your feedback to improve our auto transport service
    and products to better serve you and your company.
    &lt;/p&gt;
    &lt;/div&gt;    
    &lt;div style=&quot;text-align: center;&quot; align=&quot;center&quot;&gt;
    &lt;b&gt;
    &lt;p&gt;
    &lt;a style=&quot;font-family: Arial, Helvetica, sans-serif; letter-spacing: -3px; color: #ff0000; font-size: 24pt; text-decoration: underline;&quot;
       href=&quot;http://survey.constantcontact.com/survey/a07e5ou49kegzk6shgq/start&quot;&gt;Take this survey
      &lt;/a&gt;
      &lt;/p&gt;
      &lt;/b&gt;
      &lt;/div&gt;
      &lt;div&gt;
      &lt;/div&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td width=&quot;100%&quot; rowspan=&quot;1&quot; colspan=&quot;1&quot;&gt;
      &lt;table border=&quot;0&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;5&quot;&gt;
      &lt;tr&gt;
    &lt;td style=&quot;color:#555555;font-family:Arial,Helvetica,sans-serif;font-size:10pt;&quot;
        rowspan=&quot;1&quot; colspan=&quot;1&quot; align=&quot;left&quot;&gt;
     &lt;p&gt;Thank you for trusting your car with us!  We appreciate your participation in our survey and hope you will consider
     ShipCarsNow the next time you or someone you know needs to ship a car.
     &lt;/p&gt;
    &lt;div&gt;
   &lt;/div&gt;
   &lt;div&gt;Sincerely,
   &lt;/div&gt;   
   &lt;br/&gt; Jeff Grandstaff
   &lt;br/&gt; General Manager
   &lt;br/&gt; 1-866-207-3360
      
   &lt;br/&gt; &lt;a href=&quot;http://www.shipcarsnow.com&quot;&gt;www.shipcarsnow.com&lt;/a&gt;
   
   &lt;p&gt; Need another auto transport quote? &lt;a href=&quot;https://www.shipcarsnow.com/Residential-Auto-Shipping/why-choose-shipcarsnow.html&quot;&gt;Click here for your Free Quote!&lt;/a&gt;
   &lt;/p&gt;
   &lt;p&gt;
   PS ... Tell your favorite car dealer to put ShipCarsNow shipping quotes on their website! Our new
   
   &lt;a href=&quot;http://www.shipcarsnow.com/news/shipcarsnow-extends-dealer-services.html&quot;&gt;ConnectNOW program&lt;/a&gt;
   for dealers makes it easy.
   &lt;/p&gt;
   &lt;br/&gt; &lt;img border=&quot;0&quot; src=&quot;https://imgssl.constantcontact.com/ui/images1/btn_fbk_160_a.png&quot; /&gt;
      
   &lt;/td&gt;
   &lt;/tr&gt;
   &lt;/table&gt;
   &lt;/td&gt;
   &lt;/tr&gt;
   &lt;/table&gt;
   &lt;/td&gt;
   &lt;/tr&gt;
   &lt;/table&gt;
   &lt;/CustomBlock&gt;
   &lt;/body&gt;
   &lt;/html&gt;
</EmailContent>
<EmailTextContent>
&lt;Text>This is the text version.&lt;/Text>
</EmailTextContent>
<StyleSheet/>
<ContactLists>
<ContactList
id="http://api.constantcontact.com/ws/customers/[removed my moderator]/lists/693">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/[removed my moderator]/lists/693"
rel="self"/>
</ContactList>
</ContactLists>
<FromEmail>
<Email
id="http://api.constantcontact.com/ws/customers/[removed my moderator]/settings/emailaddresses/8">
<link xmlns="http://www.w3.org/2005/Atom"
href="/ws/customers/[removed my moderator]/settings/emailaddresses/8" rel="self"/>
</Email>
<EmailAddress>[removed my moderator]</EmailAddress>
</FromEmail>
<ReplyToEmail>
<Email
id="http://api.constantcontact.com/ws/customers/[removed my moderator]/settings/emailaddresses/8">
<link xmlns="http://www.w3.org/2005/Atom"
href="/ws/customers/[removed my moderator]/settings/emailaddresses/8" rel="self"/>
</Email>
<EmailAddress>[removed my moderator]</EmailAddress>
</ReplyToEmail>
</Campaign>
</content>
<source>
<id>http://api.constantcontact.com/ws/customers/[removed my moderator]/campaigns
</id>
<title type="text">Campaigns for customer: [removed my moderator]</title>
<link href="campaigns"/>
<link href="campaigns" rel="self"/>
<author>
<name>[removed my moderator]</name>
</author>
<updated>2009-10-21T19:36:12.622Z</updated>
</source>
</entry>

CTCT Employee

Re: Creating Campaign using JAVA giving : Response status :HTTP/1.1 400 Bad Request

Hi,

 

It looks like you're using HTML as your email type, but trying to pull contact details.  Unfortunately, our system only lets you pull contact details from the account if you're using XHTML as the email type. 

 

This link explains a little more about how to pull contact details with an XHTML email, though it does look like you're doing that correctly, taking a quick glance at your code.

 

I hope that helps!

 

Regards,

Shannon W.

API Support

 

 

Trusted Contributor

Re: Creating Campaign using JAVA giving : Response status :HTTP/1.1 400 Bad Request

Hello,

 

I've edited your post to remove any private information (email addressed, account credentials) for your security.

Mark Coleman
Support Engineer
Occasional Contributor

Re: Creating Campaign using JAVA giving : Response status :HTTP/1.1 400 Bad Request

I am gettting 403 forbidden error

Receiving response: HTTP/1.1 403 Forbidden

 

I am trying to create a contactList before creating a campaign, the link attribute of the contactList is showing as below

list : /ws/customers/null/lists

 

It was working fine earlier I was able to make schedule campaign as well.

 

 

Highlighted
Trusted Contributor

Re: Creating Campaign using JAVA giving : Response status :HTTP/1.1 400 Bad Request

Hello,

 

A 403 response can be returned if the the non-SSL version of the request uri is used (i.e., http://... should be https://..), or if the resources being accessed are for an account other than the one authorized through your authentication process.  

 

The link attribute you provided appears to be for the lists collection (the list of contact lists in the account), rather than a specific list, as well.  Is the list creation where you're getting the 403 response? 

Mark Coleman
Support Engineer