Full information about user account can be obtained by request: information about activities, contact information about the user, as well as information about bills.
getAccountDetails() : array
User account details are represented as an array that includes:
mgapi_getAccountDetails.php
getAccountDetails(); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to get account info!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "Returned:\n"; foreach ($retval as $key => $value) { if (!is_array($value)) { echo "\t" . $key . " = " . $value . "\n"; } else { echo "\t" . $key . ":\n"; foreach ($value as $k => $v) { if (!is_array($v)) { echo "\t\t" . $k . " = " . $v . "\n"; } else { echo "\t\t" . ($k + 1) . ".\n"; foreach ($v as $k_ => $v_) { echo "\t\t\t" . $k_ . " = " . $v_ . "\n"; } } } } } }
xml-rpc_getAccountDetails.php
new xmlrpcval($apikey) ), 'struct'); $f = new xmlrpcmsg('getAccountDetails', 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 $key => $value) { if (!is_array($value)) { echo "\t" . $key . " = " . $value . "\n"; } else { echo "\t" . $key . ":\n"; foreach ($value as $k => $v) { if (!is_array($v)) { echo "\t\t" . $k . " = " . $v . "\n"; } else { echo "\t\t" . ($k + 1) . ".\n"; foreach ($v as $k_ => $v_) { echo "\t\t\t" . $k_ . " = " . $v_ . "\n"; } } } } } } else { echo "Unable to get account info!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }
mgapi_getAccountDetails.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.getAccountDetails() if api.errorCode: print "Unable to get account info!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "Returned" for key,value in retval.items(): if isinstance(value, dict): print "\t", key for k,v in value.items(): if isinstance(v, dict): print "\t\t%d" % (k + 1) for k_,v_ in v.items(): print "\t\t\t", k_, " = ", v_ elif isinstance(v, list): print "\t\t%d" % (k + 1) for k_,v_ in enumerate(v): print "\t\t\t", k_, " = ", v_ else: print "\t\t", k, " = ", v elif isinstance(value, list): print "\t", key for k,v in enumerate(value): if isinstance(v, dict): print "\t\t%d" % (k + 1) for k_,v_ in v.items(): print "\t\t\t", k_, " = ", v_ elif isinstance(v, list): print "\t\t%d" % (k + 1) for k_,v_ in enumerate(v): print "\t\t\t", k_, " = ", v_ else: print "\t\t", k, " = ", v else: print "\t", key, " = ", value