The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

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

Highlighted
Occasional Participant

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

Hi,

 

Thanks for ur valuable help. I need alittle help from you. In previous version I can get optouts in retriving xml. But now I couldn't get that field. Can you please help me on this.

Highlighted
Honored Contributor

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

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
Highlighted
Occasional Participant

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

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. 

 

 

Highlighted
Occasional Participant

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

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. 

 

 

Highlighted
Honored Contributor

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

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
Occasional Participant

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

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. 

 

Highlighted
Honored Contributor

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

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
Highlighted
New Member

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

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
Highlighted
Honored Contributor

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


@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
Highlighted
Participant

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

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.

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured