lists(string apikey)
Retrieve all of the lists defined for your user account
| Section | List Related |
|---|
| Parameters |
|---|
| apikey a valid API Key for your user account. Get by calling Get by visiting your API dashboard |
| Returns | |
|---|---|
| array | list of your Lists and their associated information (see Returned Fields for description) |
| Returned Fields | string | id | The list id for this list. This will be used for all other list management functions. | string | web_id | The list id used in our web app, allows you to create a link directly to it | string | name | The name of the list. | date | date_created | The date that this list was created. | integer | member_count | The number of active members in the given list. |
|---|
[1] mcapi_lists.php
<?php /** This Example shows how to pull the Members of a List using the MCAPI.php class and do some basic error checking. **/ require_once 'inc/MCAPI.class.php'; require_once 'inc/config.inc.php'; //contains apikey $retval = $api->lists(); if ($api->errorCode){ } else { foreach ($retval as $list){ echo "\tSub = ".$list['member_count']."\tUnsub=".$list['unsubscribe_count']."\tCleaned=".$list['cleaned_count']."\n"; } }
[2] xml-rpc_lists.php
<?php /** This Example shows how to use XML-RPC to Retrieve all of the Lists on your account and display some info about them. Note that we are using the PEAR XML-RPC client and recommend others do as well. **/ require_once 'XML/RPC2/Client.php'; require_once 'inc/config.inc.php'; try { $lists = $client->lists($apikey); foreach ($lists as $list){ } } catch (XML_RPC2_FaultException $e){ } ?>