Create campaign - couldn't connect to host


Create campaign - couldn't connect to host



I have this really odd problem... I wrote an API wrapper for email services in my website. Problem is, all of the API functionality works except for creating a campaign.


The error my framework throws is:

Error fetching remote [ status 0 ] couldn't connect to host


Which is really odd, because I believe that request is correct and I have provided with correct url.


This is the code:


XML that is produced and sent:




It appears to me that it is returning the wrong error as your XML is invalid.  You should be getting back a 400 error.  Take a look at my revised XML entry which should go right into your account.  You were missing the organization information, replytoemailaddress.


<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="">
    <link href="/ws/customers/apisupport/campaigns" rel="edit"/>
    <title type="text">Sample AdSwaps campaign</title>
    <content type="application/vnd.ctct+xml">
        <Campaign xmlns="">
            <Name>1Sample AdSwaps campaign</Name>
            <Subject>Sample AdSwaps campaign email</Subject>
            <OrganizationAddress1>123 wsw st</OrganizationAddress1>
            <EmailContent>&lt;html lang="en" xml:lang="en" xmlns="" 
                &lt;body>&lt;CopyRight>Copyright (c) 1996-2009 Constant Contact. All rights reserved.  Except as permitted under a
                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
                &lt;!--  Do NOT delete previous line if you want to get statistics on the number of opened emails -->
                &lt;CustomBlock name="letter.intro" title="Personalization">
            <EmailTextContent>&lt;Text&gt;Hi there, This is a sample AdSwaps email campaign. --- XYZ
                <ContactList id="">
                    <link xmlns="" href="/ws/customers/apisupport/lists/1"
                    <link xmlns=""
                        href="/ws/customers/apisupport/settings/emailaddresses/1" rel="self"/>
                <Email id="">
                    <link xmlns="" href="/ws/customers/joesflowers/settings/emailaddresses/1"
                        rel="self" />
        <title type="text">Campaigns</title>
        <link href="campaigns" rel="self"/>

 I think that this may resolve your issue but let me know if it does not.

Ryan Davis
Quality Engineer
Developer Portal

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

Visit Page