Hi!
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 https://api.constantcontact.com/ws/customers/bagnz0r/campaigns [ 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:
Hey,
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="http://www.w3.org/2005/Atom"> <link href="/ws/customers/apisupport/campaigns" rel="edit"/> <id>http://api.constantcontact.com/ws/customers/apisupport/campaigns</id> <title type="text">Sample AdSwaps campaign</title> <updated>2011-11-02T18:37:06+01:00</updated> <author> <name>AdSwaps</name> </author> <content type="application/vnd.ctct+xml"> <Campaign xmlns="http://ws.constantcontact.com/ns/1.0/"> <Name>1Sample AdSwaps campaign</Name> <Status>Draft</Status> <Date>2011-11-02T18:37:06+01:00</Date> <Subject>Sample AdSwaps campaign email</Subject> <FromName>bagnohax@gmail.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><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:cctd="http://www.constantcontact.com/cctd"> <body><CopyRight>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 joesflowers@example.com.</CopyRight> <OpenTracking/> <!-- Do NOT delete previous line if you want to get statistics on the number of opened emails --> <CustomBlock name="letter.intro" title="Personalization"> <Greeting/> </CustomBlock> </body> </html></EmailContent> <EmailTextContent><Text>Hi there, This is a sample AdSwaps email campaign. --- XYZ Corporation.</Text></EmailTextContent> <StyleSheet></StyleSheet> <ContactLists> <ContactList id="http://api.constantcontact.com/ws/customers/apisupport/lists/1"> <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/apisupport/lists/1" rel="self"/> </ContactList> </ContactLists> <FromEmail> <Email id="http://api.constantcontact.com/ws/customers/apisupport/settings/emailaddresses/1"> <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/apisupport/settings/emailaddresses/1" rel="self"/> </Email> <EmailAddress>bagnohax@gmail.com</EmailAddress> </FromEmail> <ReplyToEmail> <Email id="http://api.constantcontact.com/ws/customers/joesflowers/settings/emailaddresses/1"> <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/joesflowers/settings/emailaddresses/1" rel="self" /> </Email> <EmailAddress>joesflowers@example.com</EmailAddress> </ReplyToEmail> </Campaign> </content> <source> <id>http://api.constantcontact.com/ws/customers/a/campaigns</id> <title type="text">Campaigns</title> <link href="campaigns" rel="self"/> <author> <name>apisupport</name> </author> <updated>2011-11-02T18:37:06+01:00</updated> </source> </entry>
I think that this may resolve your issue but let me know if it does not.