listMembers()

By sending a request that contains list ID and email settings, you can obtain emails of this list (array).

listMembers(string $id, string $status, integer $start, integer $limit) : array
Input parameters
  • id - list ID
  • status - email status (unsubscribed, inactive, bounced, subscribed) (optional). Default value is subscribed.
  • start - page number starting from which selection will be made (optional). Default value is 0.
  • limit - number of results returned in one page (optional). Default value is 100. Maximum allowable value is 15000.

Information obtained

Array of members. Each member is represented as an array consisting of:

  • email - email address
  • timestamp - date of adding email to the list in timestamp format

Examples

mgapi_listMembers.php
listMembers($id, $status, $start, $limit);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load listMembers()!";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "Members returned: " . sizeof($retval) . "\n";
    foreach ($retval as $member) {
        echo "\t" . $member['email'] . " - " . $member['timestamp'] . "\n";
    }
}
xml-rpc_listMembers.php
 new xmlrpcval($apikey),
                    'id' => new xmlrpcval($listId),
                    'status' => new xmlrpcval('subscribed'),
                    'start' => new xmlrpcval(0),
                    'limit' => new xmlrpcval(500)
                ),
                'struct');
$f = new xmlrpcmsg('listMembers', array($v));
$c = new xmlrpc_client($apiUrl["path"], $apiUrl['host'], 80);
$c->setDebug($debug);
$r = &$c->send($f);
 
header("Content-Type: text/plain");
if (!$r->faultCode()) {
    $retval = php_xmlrpc_decode($r->value());
    echo "Members returned: " . sizeof($retval) . "\n";
    foreach ($retval as $member) {
        echo "\t" . $member['email'] . " - " . $member['timestamp'] . "\n";
    }
} else {
    echo "Unable to run listMembers()!\n";
    echo "\tCode=" . $r->faultCode() . "\n";
    echo "\tMsg=" . $r->faultString() . "\n";
}
mgapi_listMembers.py
from lib.config import * #contains apikey
from lib.MGAPI import MGAPI
 
# This Example shows how to ping using the MGAPI.php class and do some basic error checking.
 
api = MGAPI(apikey)
 
id = listId
status = "subscribed"
start = 0
limit = 500
 
retval = api.listMembers(id, status, start, limit)
if api.errorCode:
    print "Unable to load listMembers()!"
    print "\tCode=", api.errorCode
    print "\tMsg=", api.errorMessage
else:
    print "Members returned: ", len(retval)
    if isinstance(retval, dict):
        for member in retval.items():
            print "\t%s - %s" % (member['email'], member['timestamp'])
    elif isinstance(retval, list):
        for member in retval:
            print "\t%s - %s" % (member['email'], member['timestamp'])

© 2010-2017 Mailigen. All rights reserved.