getAccountDetails()

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
Information obtained

User account details are represented as an array that includes:

  • user_id - user ID
  • username - username
  • member_since - date of user creating a user account
  • is_trial - whether user is only a trial account user (true, false)
  • is_epicfree - whether user is an Epic free account user (true, false)
  • plan_type - current price plan (plan, credit)
  • plan_high - email limit (how many contacts are in the monthly plan)
  • emails_left - number of emails that can be sent
  • first_payment - date of the first payment
  • last_payment - date of the last payment
  • times_logged_in - how many times user has logged in (via web)
  • last_login - date of the last login (via web)
  • contact - contact information. Array consisting of:
    • fname - first name
    • lname - last name
    • email - email
    • company - company name
    • address1 - address
    • city - city
    • state - state
    • zip - ZIP code
    • country - country
    • url - website address
    • phone - phone number
    • fax - fax number
  • email_senders - list of email senders. Each email sender is represented as an array that includes:
    • name - sender name
    • email - email
    • company - company name
    • address1 - address
    • city - city
    • state - state
    • zip - ZIP code
    • country - country
      The first email sender in the list is the account user. Then comes additional email senders if any are defined and verified.
  • sms_senders - list of SMS senders. Each SMS sender is represented as an array that includes:
    • name - sender name
    • phone - company name
    • company - company name
  • orders - information about bills. Array consisting of: 
    • invoice - bill number
    • plan_type - price plan (plan, credit)
    • plan_high - email limit (how many contacts are in the monthly plan). For plan_type credit this entry is not defined.
    • price - price
    • currency - currency
    • created_at - date of issue
    •  date_expired - date of plan expiration

Examples

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

© 2010-2017 Mailigen. All rights reserved.