listGrowthHistory()

Information about lists is obtained, divided by specific time intervals. Information is returned about number of emails at the beginning of the given time interval and growth of emails during given time interval.

listGrowthHistory(string $id, string $split_by, string $start_date, string $end_date, integer $start, integer $limit) : array
Input parameters
  • id - list ID
  • split_by - Statistics divided by periods of time: month, week, day (optional). Default is month.
  • start_date - Filter statistics from given start date. Date should be in YYYY-MM-DD format.
    Parameter end_date should be provided together with parameter start_date.
  • end_date - Filter statistics till given end date. Date should be in YYYY-MM-DD format.
    Parameter start_date should be provided together with parameter end_date.
  • 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 25. Maximum allowed value is 100.

Information obtained

Array of statistical information split by given time intervals. Each interval is represented as an array that includes:

  • according to given split_by parameter value one of following is returned:
    • month - year and month in YYYY-MM format
    • week - year, month and week returned in YYYY-MM \WW format First W is escaped prefix letter "W" before week number. Second W is a week number of year (01..53). Weeks starting from Monday. E.g. 2015-09 W36 - september, the 36th week in the year 2015.
    • day - year, month and day returned in YYYY-MM-DD format
  • existing - number of emails at the beginning of given period of time
  • imports - how many emails of new recipients have been added during the given period of time

Examples

mgapi_listBatchSubscribe.php
 $my_email, 'FNAME' => 'Joe');
$batch[] = array('EMAIL' => $boss_man_email, 'FNAME' => 'Boss');
$double_optin = true;
$update_existing = false;
 
$retval = $api->listBatchSubscribe($id, $batch, $double_optin, $update_existing);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load listBatchSubscribe()!\n";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "success:" . $retval['success_count'] . "\n";
    echo "errors:" . $retval['error_count'] . "\n";
    foreach ($retval['errors'] as $val) {
        echo "\t*" . $val['email'] . " failed\n";
        echo "\tcode:" . $val['code'] . "\n";
        echo "\tmsg :" . $val['message'] . "\n\n";
    }
}
xml-rpc_listBatchSubscribe.php
 new xmlrpcval($apikey),
                    'id' => new xmlrpcval($listId),
                    'batch' => php_xmlrpc_encode(
                            array(
                                array('EMAIL' => $my_email, 'FNAME' => 'Joe'),
                                array('EMAIL' => $boss_man_email, 'FNAME' => 'Boss')
                            )
                    ),
                    'double_optin' => new xmlrpcval(true),
                    'update_existing' => new xmlrpcval(false)
                ),
                'struct');
$f = new xmlrpcmsg('listBatchSubscribe', 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 "success:" . $retval['success_count'] . "\n";
    echo "errors:" . $retval['error_count'] . "\n";
    foreach ($retval['errors'] as $val) {
        echo "\t*" . $val['email'] . " failed\n";
        echo "\tcode:" . $val['code'] . "\n";
        echo "\tmsg :" . $val['message'] . "\n\n";
    }
} else {
    echo "Unable to load listBatchSubscribe()!";
    echo "\tCode=" . $r->faultCode() . "\n";
    echo "\tMsg=" . $r->faultString() . "\n";
}
mgapi_listBatchSubscribe.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
batch = []
batch.append({'EMAIL': my_email, 'FNAME': 'Joe'})
batch.append({'EMAIL': boss_man_email, 'FNAME': 'Boss'})
double_optin = True
update_existing = False
 
retval = api.listBatchSubscribe(id, batch, double_optin, update_existing)
if api.errorCode:
    print "Unable to load listBatchSubscribe()!"
    print "\tCode=", api.errorCode
    print "\tMsg=", api.errorMessage
else:
    print "success:", retval['success_count']
    print "errors:", retval['error_count']
    for val in retval['errors']:
        print "\t*", val['email'], " failed"
        print "\tcode:", val['code']
        print "\tmsg :", val['message']

© 2010-2017 Mailigen. All rights reserved.