lists()

All email lists (array) are obtained.

lists(integer $start = 0, integer $limit = 1000) : array
Input parametrs
  • 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 1000.
Information obtained

Array of lists. Each list is represented as an array that includes:

  • id - list ID that is used in other API functions
  • web_id - list ID that is used in the administration page
  • name - name of list
  • date_created - date of list creation
  • member_count - number of emails in list
  • sms_member_count - number of SMS in list
  • unsubscribe_count - number of unsubscribed emails
  • default_from_name - sender name (by default)
  • default_from_email - sender email (by default)
  • default_subject - subject line (by default)
  • default_language - language (by default)

Examples

mgapi_lists.php
lists();
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load lists()!";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "Lists returned: " . sizeof($retval) . "\n";
    foreach ($retval as $list) {
        echo "Id = " . $list['id'] . " - " . $list['name'] . "\n";
    }
}
xml-rpc_lists.php
 new xmlrpcval($apikey)
                ),
                'struct');
$f = new xmlrpcmsg('lists', 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 "Lists returned: " . sizeof($retval) . "\n";
    foreach ($retval as $list) {
        echo "Id = " . $list['id'] . " - " . $list['name'] . "\n";
    }
} else {
    echo "Unable to run lists()!\n";
    echo "\tCode=" . $r->faultCode() . "\n";
    echo "\tMsg=" . $r->faultString() . "\n";
}
mgapi_lists.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)
 
retval = api.lists()
if api.errorCode:
    print "Unable to load lists()!"
    print "\tCode=", api.errorCode
    print "\tMsg=", api.errorMessage
else:
    print "Lists returned: %d" % (len(retval))
    for list in retval:
        print "Id = %s - %s" % (list["id"], list["name"])

© 2010-2017 Mailigen. All rights reserved.