cancel
Showing results for 
Search instead for 
Did you mean: 
Constant Contact wants to help you succeed! We’re celebrating our professional service programs on the Constant Contact Community this month and you have a chance to try one of the services for free! Learn more.

Using Rest API to add email to a list

Highlighted
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 = "http://api.constantcontact.com/ws/customers/" & 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?
5 REPLIES 5
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
http://developer.constantcontact.com/doc/contactLists

RestClient
http://developer.constantcontact.com/node/127

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

thanks..

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.
Moderator

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.

Thanks.
Tim