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.

Other Contact List

Highlighted
Occasional Participant

Other Contact List

My current API to add contacts to a list is working with the default list. How do I change the code to put the contact is a different list and not in the default list?


My current code is:


  $url = "https://api.constantcontact.com/ws/customers/accountname/contacts";

  $data = " <entry xmlns=\"http://www.w3.org/2005/Atom\">

      <title type=\"text\"> </title>

      <updated>2008-07-23T14:21:06.407Z</updated>

      <author></author>

      <id>data:,none</id>

      <summary type=\"text\">Contact</summary>

      <content type=\"application/vnd.ctct+xml\">

      <Contact xmlns=\"http://ws.constantcontact.com/ns/1.0/\">

      <EmailAddress>". $email ."</EmailAddress>

      <FirstName>". $first ."</FirstName>

      <LastName>". $last ."</LastName>

      <OptInSource>ACTION_BY_CONTACT</OptInSource>

      <ContactLists>

      <ContactList id=\"http://api.constantcontact.com/ws/customers/fredrickgroup/lists/1\" />

      </ContactLists>

      </Contact>

      </content>

     </entry>";


 

5 REPLIES 5
Highlighted
Employee

Re: Getting the Contact List ID

Hello,



You will notice that in the XML that you have there is a section for Contact List ID:

<contactlist id="http://api.constantcontact.com/ws/customers/fredrickgroup/lists/1">



In order to add the contacts to a different list you need to add the correct contact list ID.  General Interest is generally list ID 1.



In order to find a specific lists ID, you can do a GET call to the List Collection API, and it will return XML on all of the contact lists and their List ID's.



If you have any questions please feel free to ask them on here.



Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Occasional Participant

Thank you Ben

Now, is there a way to find the List ID from the Contact CC site with out having to do the API coding?

Highlighted
Employee

RE: How to get the List ID

Hello,



The only way to find the list ID is to use the API.  The number in the user interface is not the list ID, but is the order that it appears in the UI.



Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Occasional Participant

List Collection API

When I use http://api.constantcontact.com/ws/customers/joesflowers/lists  (Using my account name) the system ask for a user id and password. I tried my account ID and PW but it does not work. What do I use?

Highlighted
Employee

Re: Login Credentials with our API

Hi,



For the purposes of using our API's, you login credentials must include your API key, like this: APIKey%username, when inserting the username.



If you do not yet have an API key, you can request one here.



If you have any further questions please let me know.



Regards,

Benjamin Soder
NOC Analyst
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
Featured