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>
<EmailAddress>". $email ."</EmailAddress>
<FirstName>". $first ."</FirstName>
<LastName>". $last ."</LastName>
<ContactList id=\"http://api.constantcontact.com/ws/customers/fredrickgroup/lists/1\" />
You will notice that in the XML that you have there is a section for Contact List ID:
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.
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.
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?
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.