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.

Using Rest API to add email to a list

Occasional Participant

Using Rest API to add email to a list

I used some VB.Net code I found to create a page that successfully adds contacts to the database, however I am having difficulty with adding them to the correct list.

I can add them to the first list (general interest) without problem, but if I change the list number to 3 (our third list), then I get an invalid page request... Here's the lines I have for addint to the list:

Dim sListUri As String = "" & sUsername & "/lists/3"
data.Append("&lists=" + HttpUtility.UrlEncode(sListUri))

Like I said, it works fine if the number on the end of the first line is '1', but it doesn't if it is '3'

Any suggestions?
Solution Provider

Re: Using Rest API to add email to a list

I would first double check that your account and make sure that your third list has a ID number 3.

You can use the Contact list Collection and the RestClient to retrieve the collection of contact lists and their ID numbers.

Contact list Collection


Mike C Support Engineer, Constant Contact

Occasional Participant

Can I not check that in the GUI

Can I check the ID of the collection somewhere in the front end? Or is it only available through the API?
Occasional Participant


I pulled a list of the lists and sure enough, even though the GUI had 3, it was listed as 4. changing to 4 worked like a charm.

The List number isn't

The List number isn't entirely related to the way the GUI lays them out. Every new list you create will be in an incremented number in our database, this just means that you have created 4 lists in your account and one of them has been deleted.
Dave Berard
Senior Product Manager, Constant Contact
New Member

Can you post your code

I am relatively new to .net and would like to see your VB code to add an email to a list in Constant Contact.

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