cancel
Showing results for 
Search instead for 
Did you mean: 

List Name not being returned

SOLVED
New Member

List Name not being returned

I am attempting to set up a simple contact form featuring a checkbox list with the lists names I have in Constant Contact. Everything seems to be working correctly, my form submits to CC and to the correct lists, however, I am also trying to use PHP to send a notification email with the new contact info and what lists they requested. I can get the other fields using $_POST, but I cannot access the submitted list names, only ids.  When I print the array $returnContact is shows the contact list object, but no name:

 

(
    [id] => 1475024793
    [status] => ACTIVE
    [first_name] => test
    [last_name] => test
    [confirmed] => 
    [source] => API
    [email_addresses] => Array
        (
            [0] => Ctct\Components\Contacts\EmailAddress Object
                (
                    [id] => 633f0820-973b-11e8-bf71-782bcb740129
                    [status] => ACTIVE
                    [confirm_status] => NO_CONFIRMATION_REQUIRED
                    [opt_in_source] => ACTION_BY_OWNER
                    [opt_in_date] => 2018-08-03T16:36:35.000Z
                    [opt_out_date] => 
                    [email_address] => bvrwtbrtretb@test.com
                )

        )

    [prefix_name] => 
    [job_title] => 
    [addresses] => Array
        (
        )

    [notes] => Array
        (
        )

    [company_name] => 
    [home_phone] => 
    [work_phone] => 
    [cell_phone] => 
    [fax] => 
    [custom_fields] => Array
        (
        )

    [lists] => Array
        (
            [0] => Ctct\Components\Contacts\ContactList Object
                (
                    [id] => 1510241668
                    [name] => 
                    [status] => ACTIVE
                    [contact_count] => 
                    [created_date] => 
                    [modified_date] => 
                )

            [1] => Ctct\Components\Contacts\ContactList Object
                (
                    [id] => 1181999304
                    [name] => 
                    [status] => ACTIVE
                    [contact_count] => 
                    [created_date] => 
                    [modified_date] => 
                )

        )

    [created_date] => 2018-08-03T16:36:35.000Z
    [modified_date] => 2018-08-03T16:36:35.000Z
    [source_details] => sekasform
)

How can I get the names of the lists submitted? Please let me know if I need to submit more information.
1 REPLY 1
Moderator

Re: List Name not being returned

Hello,

 

You can make a GET call to https://api.constantcontact.com/v2/lists/{listId} dropping in the listID (removing the brackets) and the response will include the name of the list. See this link for details on this call: http://developer.constantcontact.com/docs/contact-list-api/contactlist-resource.html

 

You can also use our Contact List Collection to get all lists at once, and then match up List IDs with their names. See here for details: http://developer.constantcontact.com/docs/contact-list-api/contactlist-collection.html

 

Regards,
David B.
Tier II API Support Engineer