By using login data of a user, you can add a new API key that can be used afterward in order to connect to the account.

apikeyAdd(string $username, string $password) : string
Input parametrs
  • username
  • password
Information obtained
  • new API key


apikeyAdd($username, $password);
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to add new API key!\n";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "Returned new API key: " . $retval . "\n";
 new xmlrpcval($apikey),
                    'username' => new xmlrpcval('username'),
                    'password' => new xmlrpcval('password')
$f = new xmlrpcmsg('apikeyAdd', array($v));
$c = new xmlrpc_client($apiUrl["path"], $apiUrl['host'], 80);
$r = &$c->send($f);
header("Content-Type: text/plain");
if (!$r->faultCode()) {
    $retval = php_xmlrpc_decode($r->value());
    echo "Returned new API key: " . $retval . "\n";
} else {
    echo "Unable to add new API key!\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)
username = "username"
password = "password"
retval = api.apikeyAdd(username, password)
if api.errorCode:
    print "Unable to add new API key!"
    print "\tCode=", api.errorCode
    print "\tMsg=", api.errorMessage
    print "Returned new API key: ", retval

© 2010-2020 Mailigen. All rights reserved.