Contact list not showing when retrieving campaign details using ws API.

Regular Participant

Contact list not showing when retrieving campaign details using ws API.

Hi,

 

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.

https://api.constantcontact.com/ws/customers/twbsind%40gmail.com/campaigns/1124895671653

 

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&amp;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: twbsind@gmail.com</title>
    <link href="campaigns"/>
    <link href="campaigns" rel="self"/>
    <author>
      <name>twbsind@gmail.com</name>
    </author>
    <updated>2016-06-22T11:58:14.790Z</updated>
  </source>
</entry>

 

Please advice what is  missing and how to proceeed .

 

Thanks & Regards

RN

34 REPLIES 34

Hello,

 

In order to get the unsubscribes for a campaign, you will want this API endpoint: http://developer.constantcontact.com/docs/campaign-tracking/opt-out-activities-collection.html

 

The request URL is in this format: https://api.constantcontact.com/v2/emailmarketing/campaigns/{campaignId}/tracking/unsubscribes

 

Please let me know if you have any questions about this!

 

Sincerely,

Elijah G.
API Support Engineer
Regular Participant

Hi,

 

Thanks for all your help. Your valuable information help me alot. 

 

Can you please tell me How could I insert contat list and contact list using code. 

 

 

Regular Participant

Hi,

 

Thanks for all your help. Your valuable information help me alot. 

 

Can you please tell me How could I insert contat list in contact lists and how to create a contact lists using code. 

 

 

Hello,

 

You can find information about creating lists with the API here: http://developer.constantcontact.com/docs/contact-list-api/contactlist-collection.html?method=POST

 

 

In addition, you can use our .NET SDK to create lists with code similar to this:

// Set up the List Service
IUserServiceContext userServiceContext = new UserServiceContext(_accessToken, _apiKey);
ConstantContactFactory serviceFactory = new ConstantContactFactory(userServiceContext);
ContactService ListServiceObject = serviceFactory.CreateListService();

// Create a List Object
ContactList myList = new ContactList();
myList.Name = "List Name";
myList.Status = "HIDDEN";

// Use the API to add the list to your Constant Contact account
ContactList createdList = ListServiceObject.AddList(myList);

For your other question, I need a bit of clarification about "insert contact list in contact lists". Do you want to merge two different lists?

 

Sincerely,

Elijah G.
API Support Engineer
Regular Participant

Hi Elijah,

 

Thanks for your help. It woks fine .Now I can create the list to contant contact. Is there any hope to add contact to Contact list using this code. 

 

Hello,

 

You absolutely can add contacts to a list using our .NET SDK. Contacts must be added to a list when you first create them, and they can also be added to a list after they're created by updating the existing contact. You can find a sample of how to create and update contacts in the sample code provided with our SDK (Link). You can also find the API documentation for these steps here:

- Create Contact: http://developer.constantcontact.com/docs/contacts-api/contacts-collection.html?method=POST

- Update Contact: http://developer.constantcontact.com/docs/contacts-api/contacts-resource.html?method=PUT

 

If you have any questions about the process, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer

Hi Elijah,

 

Its working for me.But there is a small issue in this... How can I give ContactList in this code.I have attached the code. Please help me on this.

 


2016-07-22_145252.jpg


@First-NameL2869 wrote:

Hi Elijah,

 

Its working for me.But there is a small issue in this... How can I give ContactList in this code.I have attached the code. Please help me on this.

 


In order to set the contact list in that code, you will need to use a list that has already been created. The code will look like this: 

 

contact.Lists.Add( new ContactList() { Id = "YOUR_LIST_ID" });

 

You can get the list ID by having it stored in an application config (if it is a fixed value) or by using the ListService.GetLists() method to get all of your lists and select the one you want.

 

 

 


@ThirdW0 wrote:

Hi Elijah,

 

I have done all my work relating constant contact with your valuable information.There is one requirment is pendining in my work. I am working in SAP B1 development.

 

As per your update I have added constant contact authenticatin in my project. Is there any hope to pass the costant contact username to a string after authetication. If its possible thats good for us.

 

I have attached the screen shot of my form and authentication form with this mail.

 


 

Unfortunately it is not possible to auto-fill the username at this time.

 

 

 

If I can provide any additional information, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer
Regular Participant

Hi Elijah,

I have more than 500 contacts in my contact list. I can get 500 contacts at a time with the help of following URL.


https://api.constantcontact.com/v2/lists/<ListID>/contacts?api_key=<APIKey>

But I need all contacts. After researching in constant contact developer guide I found there is an option that I get all contacts(more than 500 contacts in a list). The method that I found is "next_link ".

As per the instruction I gave following URL for getting next contacts after 500 contacts.

https://api.constantcontact.com/v2/lists/<ListID>/contacts?api_key=<APIKey>&next=/v2/lists/<ListID>/...

But on this step "HttpWebResponse response = request.GetResponse() as HttpWebResponse;" I got following error.

"The remote server returned an error: (400) Bad Request."


Please help me on this.

Hello,

 

This is called using pagination and the URL is a bit different than what you have. You should have something more like this.

https://api.constantcontact.com/v2/lists/<ListID>/contacts?limit=500&api_key=<APIKey>

 

This will give you a response that includes a URL that will contain the next page of data. You can get the format that needs to be used and an example of the response from this website. (http://developer.constantcontact.com/docs/developer-guides/paginated-output.html)


Regards,
Jimmy D.
Tier II API Support Engineer
Regular Participant

Hi ,

 

Is there anyway to get Constant contact token using Requesting URL . Currently I am using Constant contact Authentication window to get token. I attached the screen shot with this mail. 

 

But I need a URL to get authentication token. Please help me on this and let me know how to proceed and how to take Token from it.


2016-07-22_204902.jpg
Regular Participant

Its an urgent task.Please help me on this.

Hello,

 

Without being able to see the code behind that window I couldn't say for sure what method is being used. However; it does not look like it is using oAuth 2. I am just guessing, but it is probably using a URL to request the Access Token. If you can look at the code you will probably see the information being sent.

 

I would suggest setting up your application to take advantage of oAuth 2 and you can find that documentation located here. http://developer.constantcontact.com/docs/authentication/authentication.html

 

If you just need to get an Access Token you can also retrieve that data using our I/O Docs located here. https://constantcontact.mashery.com/io-docs


Regards,
Jimmy D.
Tier II API Support Engineer
Regular Participant

Hi Elijah,

 

I have done all my work relating constant contact with your valuable information.There is one requirment is pendining in my work. I am working in SAP B1 development.

 

As per your update I have added constant contact authenticatin in my project. Is there any hope to pass the costant contact username to a string after authetication. If its possible thats good for us.

 

I have attached the screen shot of my form and authentication form with this mail.

 


2016-07-22_204902.jpg
Developer Portal

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

Visit Page