All email lists (array) are obtained.
lists(integer $start = 0, integer $limit = 1000) : array
Array of lists. Each list is represented as an array that includes:
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"; } }
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"; }
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"])
Create new list..
listCreate(string $title, array $options) : string
Array of lists. Each list is represented as an array that includes:
'Write a short reminder about how the recipient joined your list.', 'notify_to' => 'example@example.org', 'subscription_notify' => true, 'unsubscription_notify' => true, 'has_email_type_option' => true ); $retval = $api->listCreate($title, $options); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listCreate()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "New List ID:" . $retval . "\n"; }
new xmlrpcval($apikey), 'title' => new xmlrpcval('Test List'), 'options' => php_xmlrpc_encode( array( "permission_reminder" => 'Write a short reminder about how the recipient joined your list.', "notify_to" => 'example@example.org', "subscription_notify" => true, "unsubscription_notify" => true, "has_email_type_option" => true ) ) ), 'struct'); $f = new xmlrpcmsg('listCreate', 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 "Returned: " . $retval . "\n"; } else { echo "Unable to load listCreate()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
Update list parameters.
listUpdate(string $id, string $name, $value) : boolean
listUpdate($id, $name, $value); header("Content-Type: text/plain"); if ($api->errorCode){ echo "Unable to load listUpdate()!\n"; echo "\tCode=".$api->errorCode."\n"; echo "\tMsg=".$api->errorMessage."\n"; } else { echo "SUCCESS! \n"; }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId), 'name' => new xmlrpcval('title'), 'value' => new xmlrpcval('New Title') ), 'struct'); $f = new xmlrpcmsg('listUpdate', 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 "Returned: " . $retval . "\n"; } else { echo "Unable to load listUpdate()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
List is deleted from the database..
listDelete(string $id) : boolean
listDelete($id, $tag); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listDelete()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "List Deleted!\n"; }
This function obtains merge fields (array) from database, as well as all the necessary parameters of these fields.
listMergeVars(string $id) : array
Array of merge fields. Each merge field is represented as an array that includes:
listMergeVars($id); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listMergeVars()!"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Merge tags returned: " . sizeof($retval) . "\n"; foreach ($retval as $i => $var) { echo "Var #$i:\n"; echo "\tTag: " . $var['tag'] . "\n"; echo "\tName: " . $var['name'] . "\n"; echo "\tRequired: " . $var['req'] . "\n"; } }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId) ), 'struct'); $f = new xmlrpcmsg('listMergeVars', 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 "Merge tags returned: " . sizeof($retval) . "\n"; foreach ($retval as $i => $var) { echo "Var #$i:\n"; echo "\tTag: " . $var['tag'] . "\n"; echo "\tName: " . $var['name'] . "\n"; echo "\tRequired: " . $var['req'] . "\n"; } } else { echo "Unable to run listMergeVars()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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 retval = api.listMergeVars(id) if api.errorCode: print "Unable to load listMergeVars()!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "Merge tags returned: ", len(retval) if isinstance(retval, dict): for i,var in retval.items(): print "Var #%d:" % (i) print "\tTag: ", var['tag'] print "\tName: ", var['name'] print "\tRequired: ", var['req'] elif isinstance(retval, list): for i,var in enumerate(retval): print "Var #%d:" % (i) print "\tTag: ", var['tag'] print "\tName: ", var['name'] print "\tRequired: ", var['req']
This function adds a new merge field to a particular list in the database adding also the name and settings of this field.
listMergeVarAdd(string $id, string $tag, string $name, array $options) : boolean
Array of merge fields. Each merge field is represented as an array that includes:
'text', "req" => false, "default_value" => 'Default value', "show" => true ); $retval = $api->listMergeVarAdd($id, $tag, $name, $options); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listMergeVarAdd()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned: " . $retval . "\n"; }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId), 'tag' => new xmlrpcval('MERGE_TAG'), 'name' => new xmlrpcval('Merge Tag name'), 'options' => php_xmlrpc_encode( array( "field_type" => 'text', "req" => false, "default_value" => 'Default value', "show" => true ) ) ), 'struct'); $f = new xmlrpcmsg('listMergeVarAdd', 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 "Returned: " . $retval . "\n"; } else { echo "Unable to load listMergeVarAdd()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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 tag = 'MERGE_TAG' name = 'Merge Tag name' options = { "field_type": 'text', "req": False, "default_value": 'Default value', "show": True } retval = api.listMergeVarAdd(id, tag, name, options) if api.errorCode: print "Unable to load listMergeVarAdd()!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "Returned: ", retval
Update of merge field parameters. It is not possible to change the type of merge field.
listMergeVarUpdate(string $id, string $tag, array $options) : boolean
Array of merge fields. Each merge field is represented as an array that includes:
false, "name" => 'Merge Tag name', "default_value" => 'Default value', "show" => true ); $retval = $api->listMergeVarUpdate($id, $tag, $options); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listMergeVarUpdate()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned: " . $retval . "\n"; }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId), 'tag' => new xmlrpcval('MERGE_TAG'), 'options' => php_xmlrpc_encode( array( "req" => false, "name" => 'Merge Tag name', "default_value" => 'Default value', "show" => true ) ) ), 'struct'); $f = new xmlrpcmsg('listMergeVarUpdate', 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 "Returned: " . $retval . "\n"; } else { echo "Unable to load listMergeVarUpdate()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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 tag = 'MERGE_TAG' options = { "req": False, "name": 'Merge Tag name', "default_value": 'Default value', "show": True } retval = api.listMergeVarUpdate(id, tag, options) if api.errorCode: print "Unable to load listMergeVarUpdate()!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "Returned: ", retval
Merge field is deleted from the database, as well as deleted the value of field from all contacts in the list.
listMergeVarDel(string $id, string $tag) : boolean
Array of merge fields. Each merge field is represented as an array that includes:
false, "name" => 'Merge Tag name', "default_value" => 'Default value', "show" => true ); $retval = $api->listMergeVarUpdate($id, $tag, $options); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listMergeVarUpdate()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned: " . $retval . "\n"; }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId), 'tag' => new xmlrpcval('MERGE_TAG'), 'options' => php_xmlrpc_encode( array( "req" => false, "name" => 'Merge Tag name', "default_value" => 'Default value', "show" => true ) ) ), 'struct'); $f = new xmlrpcmsg('listMergeVarUpdate', 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 "Returned: " . $retval . "\n"; } else { echo "Unable to load listMergeVarUpdate()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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 tag = 'MERGE_TAG' options = { "req": False, "name": 'Merge Tag name', "default_value": 'Default value', "show": True } retval = api.listMergeVarUpdate(id, tag, options) if api.errorCode: print "Unable to load listMergeVarUpdate()!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "Returned: ", retval
This function adds a new email to existing list with all additional values of the field.
listSubscribe(string $id, string $email_address, array $merge_vars, string $email_type, boolean $double_optin, boolean $update_existing, boolean $send_welcome) : boolean
Array of merge fields. Each merge field is represented as an array that includes:
$my_email, 'FNAME' => 'Joe'); // or $merge_vars = array(); $email_type = 'html'; $double_optin = true; $update_existing = false; $send_welcome = false; $retval = $api->listSubscribe($id, $email_address, $merge_vars, $email_type, $double_optin, $update_existing, $send_welcome); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listSubscribe()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned: " . $retval . "\n"; }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId), 'email_address' => new xmlrpcval($my_email), 'merge_vars' => php_xmlrpc_encode( array('EMAIL' => $my_email, 'FNAME' => 'Joe') ), 'email_type' => new xmlrpcval('html'), 'double_optin' => new xmlrpcval(true), 'update_existing' => new xmlrpcval(false), 'send_welcome' => new xmlrpcval(false) ), 'struct'); $f = new xmlrpcmsg('listSubscribe', 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 "Returned: " . $retval . "\n"; } else { echo "Unable to load listSubscribe()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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 email_address = my_email merge_vars = {'EMAIL': my_email, 'FNAME': 'Joe'} # or merge_vars = {} email_type = 'html' double_optin = True update_existing = False send_welcome = False retval = api.listSubscribe(id, email_address, merge_vars, email_type, double_optin, update_existing, send_welcome) if api.errorCode: print "Unable to load listSubscribe()!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "Returned: ", retval
This function removes recipient email from existing list with all additional field values. The functionality is similar if recipient unsubscribes using unsubscribe link.
istUnsubscribe(string $id, string $email_address, boolean $delete_member, boolean $send_goodbye, boolean $send_notify) : boolean
Array of merge fields. Each merge field is represented as an array that includes:
listUnsubscribe($id, $email_address, $delete_member, $send_goodbye, $send_notify); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listUnsubscribe()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned: " . $retval . "\n"; }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId), 'email_address' => new xmlrpcval($my_email), 'delete_member' => new xmlrpcval(false), 'send_goodbye' => new xmlrpcval(true), 'send_notify' => new xmlrpcval(false) ), 'struct'); $f = new xmlrpcmsg('listUnsubscribe', 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 "Returned: " . $retval . "\n"; } else { echo "Unable to load listBatchUnsubscribe()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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 email_address = my_email delete_member = False send_goodbye = True send_notify = False retval = api.listUnsubscribe(id, email_address, delete_member, send_goodbye, send_notify) if api.errorCode: print "Unable to load listUnsubscribe()!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "Returned: ", retval
This function adds a new phone number to existing list with all additional values of the field.
listSubscribeSMS(string $id, string $phone, array $merge_vars, boolean $update_existing) : boolean
Array of merge fields. Each merge field is represented as an array that includes:
$my_phone, 'FNAME' => 'Joe'); // or $merge_vars = array(); $update_existing = false; $retval = $api->listSubscribeSMS($id, $phone, $merge_vars, $update_existing); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listSubscribeSMS()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned: " . $retval . "\n"; }
This function removes recipient phone number from existing list with all additional field values.
listSubscribeSMS(string $id, string $phone, array $merge_vars, boolean $update_existing) : boolean
Array of merge fields. Each merge field is represented as an array that includes:
listUnsubscribeSMS($id, $phone, $delete_member, $send_notify); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listUnsubscribeSMS()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned: " . $retval . "\n"; }
Array of recipients’ emails with settings and merge fields are passed, but information (also array) about how many emails have been added to a specific list is returned.
listBatchSubscribe(string $id, array $batch, boolean $double_optin, boolean $update_existing) : struct
Array consisting of:
$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"; } }
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"; }
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']
Emails from the selected list are deleted. Array of recipients’ emails with additional parameters are passed, which determine whether a message/notification about email removal will or will not be sent to this particular email.
listBatchUnsubscribe(string $id, array $emails, boolean $delete_member, boolean $send_goodbye, boolean $send_notify) : struct
Array consisting of:
listBatchUnsubscribe($id, $emails, $delete_member, $send_goodbye, $send_notify); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listBatchUnsubscribe()!\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"; } }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId), 'emails' => php_xmlrpc_encode(array($my_email, $boss_man_email)), 'delete_member' => new xmlrpcval(false), 'send_goodbye' => new xmlrpcval(true), 'send_notify' => new xmlrpcval(false) ), 'struct'); $f = new xmlrpcmsg('listBatchUnsubscribe', 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 listBatchUnsubscribe()!"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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; emails = [my_email, boss_man_email] delete_member = False send_goodbye = True send_notify = False retval = api.listBatchUnsubscribe(id, emails, delete_member, send_goodbye, send_notify) if api.errorCode: print "Unable to load listBatchUnsubscribe()!" 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']
Array of recipients’ phone numbers with settings and merge fields are passed, but information (also array) about how many phone numbers have been added to a specific list is returned.
listBatchSubscribeSMS(string $id, array $batch, boolean $update_existing) : struct
Array consisting of:
$my_phone, 'FNAME' => 'Joe'); $batch[] = array('SMS' => $boss_phone, 'FNAME' => 'Boss'); $update_existing = false; $retval = $api->listBatchSubscribeSMS($id, $batch, $update_existing); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listBatchSubscribeSMS()!\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['phone'] . " failed\n"; echo "\tcode:" . $val['code'] . "\n"; echo "\tmsg :" . $val['message'] . "\n\n"; } }
Phone numbers from the selected list are deleted. Array of recipients’ phone numbers with additional parameters are passed, which determine whether a notification about phone number removal will or will not be sent.
listBatchUnsubscribeSMS(string $id, array $phones, boolean $delete_member, boolean $send_notify) : struct
Array consisting of:
listBatchUnsubscribeSMS($id, $phones, $delete_member, $send_notify); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listBatchUnsubscribeSMS()!\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['phone'] . " failed\n"; echo "\tcode:" . $val['code'] . "\n"; echo "\tmsg :" . $val['message'] . "\n\n"; } }
Email or merge fields of this email is updated. Appropriate entry of recipient can be found both by e-mail and merge fields.
listUpdateMember(string $id, string $email_address, array $merge_vars, string $email_type) : boolean
'Richard', "LNAME" => 'Wright'); $email_type = 'html'; $retval = $api->listUpdateMember($id, $email_address, $merge_vars, $email_type); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listUpdateMember()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned: " . $retval . "\n"; }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId), 'email_address' => new xmlrpcval($my_email), 'merge_vars' => php_xmlrpc_encode( array("FNAME" => 'Richard', "LNAME" => 'Wright') ), 'email_type' => new xmlrpcval('html') ), 'struct'); $f = new xmlrpcmsg('listUpdateMember', 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 "Returned: " . $retval . "\n"; } else { echo "Unable to load listUpdateMember()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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 email_address = my_email merge_vars = {"FNAME": 'Richard', "LNAME": 'Wright'} email_type = 'html' retval = api.listUpdateMember(id, email_address, merge_vars, email_type) if api.errorCode: print "Unable to load listUpdateMember()!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "Returned: ", retval
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
Array of members. Each member is represented as an array consisting of:
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"; } }
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"; }
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'])
By sending a request that contains list ID and email address, you can obtain full information about the email of a specific recipient.
listMemberInfo(string $id, string $email_address) : array
Information about email (array):
listMemberInfo($id, $email_address); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listMemberInfo()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { foreach ($retval as $k => $v) { if (is_array($v)) { //handle the merges foreach ($v as $l => $w) { echo "\t$l = $w\n"; } } else { echo "$k = $v\n"; } } }
new xmlrpcval($apikey), 'id' => new xmlrpcval($listId), 'email_address' => new xmlrpcval($my_email) ), 'struct'); $f = new xmlrpcmsg('listMemberInfo', 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()); foreach ($retval as $k => $v) { if (is_array($v)) { //handle the merges foreach ($v as $l => $w) { echo "\t$l = $w\n"; } } else { echo "$k = $v\n"; } } } else { echo "Unable to run listMemberInfo()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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 email_address = my_email retval = api.listMemberInfo(id, email_address) if api.errorCode: print "Unable to load listMemberInfo()!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: for k,v in retval.items(): if isinstance(v, dict): #handle the merges for l,w in v.items(): print "\t", l, " = ", w elif isinstance(v, list): #handle the merges for l,w in enumerate(v): print "\t", l, " = ", w else: print k, " = ", v
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
Array of statistical information split by given time intervals. Each interval is represented as an array that includes:
$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"; } }
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"; }
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']
Information with email address is passed on the server, and search in lists for a particular email is performed. The whole array of all these lists is returned.
listsForEmail(string $email_address) : array
Array consisting of:
listsForEmail($email_address); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to get lists ID!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned:\n"; foreach ($retval as $id) { echo "\tID = " . $id . "\n"; } }
new xmlrpcval($apikey), 'email_address' => new xmlrpcval($my_email) ), 'struct'); $f = new xmlrpcmsg('listsForEmail', 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 "Returned:\n"; foreach ($retval as $id) { echo "\tid = " . $id . "\n"; } } else { echo "Unable to get lists ID!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
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) email_address = my_email retval = api.listsForEmail(email_address) if api.errorCode: print "Unable to get lists ID!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "Returned: " if isinstance(retval, dict): for id in retval.items(): print "\tID = ", id elif isinstance(retval, list): for id in retval: print "\tID = ", id
List of all segments is obtained.
listBatchSubscribe(string $id, array $batch, boolean $double_optin, boolean $update_existing) : struct
Array of segments. Each segment is represented as an array that includes:
listSegments($id); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listSegments()!"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "List Segments returned: " . sizeof($retval) . "\n"; foreach ($retval as $segment) { echo "Id = " . $segment['id'] . " - " . $segment['name'] . "\n"; } }
List of all segment members is obtained.
listSegmentMembers(integer $id, string $status, integer $start, integer $limit) : array
Array of members. Each member is represented as an array consisting of:
listSegmentMembers($id, $status, $start, $limit); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listSegmentMembers()!"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Members returned: ". sizeof($retval). "\n"; foreach ($retval as $segment) { echo "\t".$member['email']." - ".$member['timestamp']."\n"; } }
New segment is created for a given single list. You may add multiple rules to filter out contacts in your list by merge field values. Provide match type to match all or any of given rules.
listSegmentCreate(string $list, string $title, string $match, array $filter) : string
'merge0', 'condition' => 'ends', //is, not, isany, contains, notcontain, starts, ends, greater, less 'value' => '@gmail.com', ), //... array( 'field' => 'confirm_time', 'condition' => 'greater', 'value' => '2013-01-01', ), ); $retval = $api->listSegmentCreate($list, $title, $match, $filter); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listSegmentCreate()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "New Segment ID:" . $retval . "\n"; }
Update segment parameter, such as name, match type or filter.
listSegmentUpdate(integer $sid, string $name, string $value) : boolean
listSegmentUpdate($sid, $name, $value); header("Content-Type: text/plain"); if ($api->errorCode){ echo "Unable to load listSegmentUpdate()!\n"; echo "\tCode=".$api->errorCode."\n"; echo "\tMsg=".$api->errorMessage."\n"; } else { echo "SUCCESS! \n"; }
Segment is deleted from the database.
listSegmentDelete(string $sid) : boolean
listSegmentDelete($sid); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listSegmentDelete()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Segment Deleted!\n"; }