Other Contact List

Franw
Regular 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
bsoder
Employee

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
Franw
Regular Participant

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

bsoder
Employee

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
Franw
Regular Participant

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?

bsoder
Employee

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