Campaign details retieved using the following API uri is not listing the contactlist associated with the campaign.
FYI:The account used for testing is in expired state.
Response from the api is given below:
<?xml version='1.0' encoding='UTF-8'?> <entry xmlns="http://www.w3.org/2005/Atom"> <link href="/ws/customers/twbsind%40gmail.com/campaigns/1124895671653" rel="edit"/> <id>http://api.constantcontact.com/ws/customers/twbsind%40gmail.com/campaigns/1124895671653</id> <title type="text">Jithin Campaign</title> <updated>2016-06-03T09:05:38.513Z</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/twbsind%40gmail.com/campaigns/1124895671653"> <Name>Jithin Campaign</Name> <Status>Sent</Status> <Date>2016-06-03T09:05:38.513Z</Date> <LastEditDate>2016-06-22T11:58:14.383Z</LastEditDate> <LastRunDate>2016-06-03T09:05:38.509Z</LastRunDate> <Sent>1</Sent> <Opens>0</Opens> <Clicks>0</Clicks> <Bounces>0</Bounces> <Forwards>0</Forwards> <OptOuts>0</OptOuts> <SpamReports>0</SpamReports> <SharePageURL>http://myemail.constantcontact.com/-enter-subject-here-.html?soid=1124448820800&aid=99SEhECL4Z4</SharePageURL> <Subject>Test for Campaing list</Subject> <FromName>Jithin</FromName> <CampaignType>TEMPLATE_V2</CampaignType> <ViewAsWebpage>NO</ViewAsWebpage> <ViewAsWebpageLinkText></ViewAsWebpageLinkText> <ViewAsWebpageText></ViewAsWebpageText> <PermissionReminder>NO</PermissionReminder> <PermissionReminderText></PermissionReminderText> <GreetingSalutation></GreetingSalutation> <GreetingString></GreetingString> <OrganizationName>TW</OrganizationName> <OrganizationAddress1>ABC</OrganizationAddress1> <OrganizationAddress2>DEF</OrganizationAddress2> <OrganizationAddress3>GHI</OrganizationAddress3> <OrganizationCity>AZ</OrganizationCity> <OrganizationState>nj</OrganizationState> <OrganizationInternationalState></OrganizationInternationalState> <OrganizationCountry>us</OrganizationCountry> <OrganizationPostalCode>07747</OrganizationPostalCode> <IncludeForwardEmail>NO</IncludeForwardEmail> <ForwardEmailLinkText></ForwardEmailLinkText> <IncludeSubscribeLink>NO</IncludeSubscribeLink> <SubscribeLinkText></SubscribeLinkText> <ArchiveStatus></ArchiveStatus> <ArchiveURL></ArchiveURL> <FromEmail> <Email id="http://api.constantcontact.com/ws/customers/twbsind%40gmail.com/settings/emailaddresses/0"> <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/twbsind%40gmail.com/settings/emailaddresses/0" rel="self"/> </Email> <EmailAddress></EmailAddress> </FromEmail> <ReplyToEmail> <Email id="http://api.constantcontact.com/ws/customers/twbsind%40gmail.com/settings/emailaddresses/0"> <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/twbsind%40gmail.com/settings/emailaddresses/0" rel="self"/> </Email> <EmailAddress></EmailAddress> </ReplyToEmail> <Date>2016-06-03T09:02:23.518Z</Date> <LastEditDate>2016-06-03T09:05:38.513Z</LastEditDate> <LastRunDate>2016-06-03T09:05:38.509Z</LastRunDate> <GreetingName>NONE</GreetingName> <ProductID>1</ProductID> <ShowAgent>true</ShowAgent> </Campaign> </content> <source> <id>http://api.constantcontact.com/ws/customers/twbsind%40gmail.com/campaigns</id> <title type="text">Campaigns for customer: email@example.com</title> <link href="campaigns"/> <link href="campaigns" rel="self"/> <author> <name>firstname.lastname@example.org</name> </author> <updated>2016-06-22T11:58:14.790Z</updated> </source> </entry>
Please advice what is missing and how to proceeed .
Thanks & Regards
After digging into this a bit, it appears the problem is a compatibility issue between the V1 (/ws) API and the structure of emails created with our new 3rd generation editor (3GE). This is not an issue with our newer V2 API, and switching to using the V2 API is definitely the suggested solution to this problem. Is there a specific reason that you chose to work with our V1 API rather than the newer V2 API?
As a side note, I do want to mention that the V1 API is in a deprecated state and currently only receives fixes for security issues and the most critical bugs. I would strongly suggest against starting new development on the V1 API.
Constantcontact API had implemented some 5-6 years ago with the ws (V1) version which was the one available at that time and was working without issues through these years. We will try with new V2 API as suggested.
Thanks for the reply.
Thanks for your help. But if I give the url as 'http://developer.constantcontact.com/docs/email-campaigns/email-campaigns-collection.html , we can get the result as given below.
But we need the campaign details, same as the xml that we posted in the question and also we need contact list in that xml. Please le me know your reply.
In order to get the information you want, you'll want to use the individual campaign endpoint, for which you can find the documentation here: http://developer.constantcontact.com/docs/email-campaigns/email-campaign-resource.html
For the sample in your post, you would make a GET call to https://api.constantcontact.com/v2/emailmarketing/campaigns/1100395494220.
This data will include the contact list as well as other campaign details that you will need. If you have any questions, please let me know!
I got an another issue on HttpWebResponse response = request.GetResponse() as HttpWebResponse; code.
I am working V1 version. But after updating to v2 I changed the URL as https://api.constantcontact.com/v2/emailmarketing/campaigns/1100395494220. But When the issued code reached it throw an excetpion. The excepetion is "The remote server returned an error: (403) Forbidden.".
I am using V1API Code. is that the issue? If that, how to upgrade the V1API code to V2API code. Please let me know the procedure.
We are using username,pasword to get the Campaign details. When I checked the authentication it look different. Is we can use same procedure for V2, for getting the Campaign details?
There are likely two components to the issue you're seeing:
You can resolve both of those by following the first three steps here: https://constantcontact.mashery.com/
Once you have both, you will need to append the api key as a query parameter, so that https://api.constantcontact.com/v2/emailmarketing/campaigns/1100395494220 becomes https://api.constantcontact.com/v2/emailmarketing/campaigns/1100395494220?api_key=APIKEY.
Next you'll need to send a different authorization header instead of the username/password. the format of the header is:
Authorization: Bearer ACCESS_TOKEN
Once you have both the new API key and a token, you should be able to successfully make API calls.
Thanks for the help. As per your reply, I have registered the Addon in Contant contact mashery account. After registration,I got the API key and token. But when I search for getting Campaign details using a campaign id using your seach window I am getting an error. I am attaching the screen shot with this mail. Please help me on this.
Based on your screenshot (Which I've removed to protect your information) and my own testing, it looks like the problem is that you've got an extra space in front of your token that's messing up the auth header. If you remove that space, it should start working as expected!