« Back to Documentation Overview

lists – v1.3

 lists(string apikey, array filters, int start, int limit)

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 visiting your API dashboard
filters a hash of filters to apply to this query - all are optional:
stringlist_idoptional - return a single list using a known list_id. Accepts multiples separated by commas when not using exact matching
stringlist_nameoptional - only lists that match this name
stringfrom_nameoptional - only lists that have a default from name matching this
stringfrom_emailoptional - only lists that have a default from email matching this
stringfrom_subjectoptional - only lists that have a default from email matching this
stringcreated_beforeoptional - only show lists that were created before this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
stringcreated_afteroptional - only show lists that were created since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
booleanexactoptional - flag for whether to filter on exact values when filtering, or search within content for filter values - defaults to true
start optional - control paging of lists, start results at this list #, defaults to 1st page of data (page 0)
limit optional - control paging of lists, number of lists to return with each call, defaults to 25 (max=100)
Returns
array an array with keys listed in Returned Fields below
inttotalthe total number of lists which matched the provided filters
arraydatathe lists which matched the provided filters, including the following for
stringidThe list id for this list. This will be used for all other list management functions.
intweb_idThe list id used in our web app, allows you to create a link directly to it
stringnameThe name of the list.
stringdate_createdThe date that this list was created.
booleanemail_type_optionWhether or not the List supports multiple formats for emails or just HTML
booleanuse_awesomebarWhether or not campaigns for this list use the Awesome Bar in archives by default
stringdefault_from_nameDefault From Name for campaigns using this list
stringdefault_from_emailDefault From Email for campaigns using this list
stringdefault_subjectDefault Subject Line for campaigns using this list
stringdefault_languageDefault Language for this list's forms
intlist_ratingAn auto-generated activity score for the list (0 - 5)
stringsubscribe_url_shortOur eepurl shortened version of this list's subscribe form (will not change)
stringsubscribe_url_longThe full version of this list's subscribe form (host will vary)
stringbeamer_addressThe email address to use for this list's Email Beamer
arraystatsvarious stats and counts for the list - many of these are cached for at least 5 minutes
intmember_countThe number of active members in the given list.
intunsubscribe_countThe number of members who have unsubscribed from the given list.
intcleaned_countThe number of members cleaned from the given list.
intmember_count_since_sendThe number of active members in the given list since the last campaign was sent
intunsubscribe_count_since_sendThe number of members who have unsubscribed from the given list since the last campaign was sent
intcleaned_count_since_sendThe number of members cleaned from the given list since the last campaign was sent
intcampaign_countThe number of campaigns in any status that use this list
intgrouping_countThe number of Interest Groupings for this list
intgroup_countThe number of Interest Groups (regardless of grouping) for this list
intmerge_var_countThe number of merge vars for this list (not including the required EMAIL one)
intavg_sub_ratethe average number of subscribe per month for the list (empty value if we haven't calculated this yet)
intavg_unsub_ratethe average number of unsubscribe per month for the list (empty value if we haven't calculated this yet)
inttarget_sub_ratethe target subscription rate for the list to keep it growing (empty value if we haven't calculated this yet)
intopen_ratethe average open rate per campaign for the list (empty value if we haven't calculated this yet)
intclick_ratethe average click rate per campaign for the list (empty value if we haven't calculated this yet)
arraymodulesAny list specific modules installed for this list (example is SocialPro)

Examples (2)

download example code

[1] mcapi_lists.php

  1. <?php
  2. /**
  3. This Example shows how to pull the Members of a List using the MCAPI.php
  4. class and do some basic error checking.
  5. **/
  6. require_once 'inc/MCAPI.class.php';
  7. require_once 'inc/config.inc.php'; //contains apikey
  8.  
  9. $api = new MCAPI($apikey);
  10.  
  11. $retval = $api->lists();
  12.  
  13. if ($api->errorCode){
  14. echo "Unable to load lists()!";
  15. echo "\n\tCode=".$api->errorCode;
  16. echo "\n\tMsg=".$api->errorMessage."\n";
  17. } else {
  18. echo "Lists that matched:".$retval['total']."\n";
  19. echo "Lists returned:".sizeof($retval['data'])."\n";
  20. foreach ($retval['data'] as $list){
  21. echo "Id = ".$list['id']." - ".$list['name']."\n";
  22. echo "Web_id = ".$list['web_id']."\n";
  23. echo "\tSub = ".$list['stats']['member_count'];
  24. echo "\tUnsub=".$list['stats']['unsubscribe_count'];
  25. echo "\tCleaned=".$list['stats']['cleaned_count']."\n";
  26. }
  27. }
  28.  
  29. ?>
  30.  

[2] xml-rpc_lists.php

  1. <?php
  2. /**
  3. This Example shows how to use XML-RPC to Retrieve all of the Lists on your
  4. account and display some info about them.
  5. Note that we are using the PEAR XML-RPC client and recommend others do as well.
  6. **/
  7. require_once 'XML/RPC2/Client.php';
  8. require_once 'inc/config.inc.php';
  9. try {
  10. $client = XML_RPC2_Client::create($apiUrl);
  11.  
  12. $lists = $client->lists($apikey);
  13. echo "SUCCESS!\n";
  14. foreach ($lists as $list){
  15. echo "Id = ".$list['id']." - ".$list['name']."\n";
  16. }
  17. } catch (XML_RPC2_FaultException $e){
  18. echo "ERROR!!!!\n";
  19. echo $e->getFaultCode()." : ".$e->getFaultString()."\n";
  20. }
  21. ?>
  22.