« Back to Documentation Overview

listMemberInfo – v1.3

 listMemberInfo(string apikey, string id, array email_address)

Get all the information for particular members of a list

Section
List Related
Parameters
apikey a valid API Key for your user account. Get by visiting your API dashboard
id the list id to connect to. Get by calling lists()
email_address an array of up to 50 email addresses to get information for OR the "id"(s) for the member returned from listMembers, Webhooks, and Campaigns. For backwards compatibility, if a string is passed, it will be treated as an array with a single element (will not work with XML-RPC).
Returns
array array of list members with their info in an array (see Returned Fields for details)
intsuccessthe number of subscribers successfully found on the list
interrorsthe number of subscribers who were not found on the list
arraydataan array of arrays where each one has member info:
stringidThe unique id for this email address on an account
stringemailThe email address associated with this record
stringemail_typeThe type of emails this customer asked to get: html, text, or mobile
arraymergesAn associative array of all the merge tags and the data for those tags for this email address. Note: Interest Groups are returned as comma delimited strings - if a group name contains a comma, it will be escaped with a backslash. ie, "," => "\,". Groupings will be returned with their "id" and "name" as well as a "groups" field formatted just like Interest Groups
stringstatusThe subscription status for this email address, either pending, subscribed, unsubscribed, or cleaned
stringip_optIP Address this address opted in from.
stringip_signupIP Address this address signed up from.
intmember_ratingthe rating of the subscriber. This will be 1 - 5 as described here
stringcampaign_idIf the user is unsubscribed and they unsubscribed from a specific campaign, that campaign_id will be listed, otherwise this is not returned.
arraylistsAn associative array of the other lists this member belongs to - the key is the list id and the value is their status in that list.
date timestamp The time this email address was added to the list
date info_changed The last time this record was changed. If the record is old enough, this may be blank.
intweb_idThe Member id used in our web app, allows you to create a link directly to it
arraygeothe geographic information if we have it. including:
stringlatitudethe latitude
stringlongitudethe longitude
stringgmtoffGMT offset
stringdstoffGMT offset during daylight savings (if DST not observered, will be same as gmtoff
stringtimezonethe timezone we've place them in
stringcc2 digit ISO-3166 country code
stringregiongenerally state, province, or similar
arrayclientsthe client we've tracked the address as using with two keys:
stringnamethe common name of the client
stringicon_urla url representing a path to an icon representing this client
arraystatic_segmentsstatic segments the member is a part of including:
intidthe segment id
stringnamethe name given to the segment
stringaddedthe date the member was added

Examples (2)

download example code

[1] mcapi_listMemberInfo.php

  1. <?php
  2. /**
  3. This Example shows how to pull the Info for a Member 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->listMemberInfo( $listId, array($my_email, $boss_man_email) );
  12.  
  13. if ($api->errorCode){
  14. echo "Unable to load listMemberInfo()!\n";
  15. echo "\tCode=".$api->errorCode."\n";
  16. echo "\tMsg=".$api->errorMessage."\n";
  17. } else {
  18. echo "Success:".$retval['success']."\n";
  19. echo "Errors:".sizeof($retval['error'])."\n";
  20. //below is stupid code specific to what is returned
  21. //Don't actually do something like this.
  22. $i = 0;
  23. foreach($retval['data'] as $k=>$v){
  24. echo 'Member #'.(++$i)."\n";
  25. if (is_array($v)){
  26. //handle the merges
  27. foreach($v as $l=>$w){
  28. if (is_array($w)){
  29. echo "\t$l:\n";
  30. foreach($w as $m=>$x){
  31. echo "\t\t$m = $x\n";
  32. }
  33. } else {
  34. echo "\t$l = $w\n";
  35. }
  36. }
  37. } else {
  38. echo "$k = $v\n";
  39. }
  40. }
  41. }
  42.  
  43. ?>
  44.  

[2] xml-rpc_listMemberInfo.php

  1. <?php
  2. /**
  3. This Example shows how to retrieve a list subscriber's information using XML-RPC
  4. Note that we are using the PEAR XML-RPC client and recommend others do as well.
  5. **/
  6. require_once 'XML/RPC2/Client.php';
  7. require_once 'inc/config.inc.php';
  8. try {
  9. $client = XML_RPC2_Client::create($apiUrl);
  10.  
  11. $result = $client->listMemberInfo($apikey, $listId, $my_email);
  12. echo "SUCCESS! \n";
  13. echo "Info for: ".$result['email']."\n";
  14. echo " Email Type: ".$result['email_type']."\n";
  15. echo " Status: ".$result['status']."\n";
  16. echo " Timestamp: ".$result['timestamp']."\n";
  17. echo " Merges:\n";
  18. foreach($result['merges'] as $k=>$v){
  19. echo "\t$k = $v\n";
  20. }
  21. } catch (XML_RPC2_FaultException $e){
  22. echo "ERROR!!!!\n";
  23. echo 'code: '.$e->getFaultCode()."\n";
  24. echo 'msg : '.$e->getFaultString()."\n";
  25. }
  26.  
  27. ?>
  28.