A request is sent by using login data, and as a result, API keys of a specific user account are returned.
apikeys(string $username, string $password, boolean $expired) : array
An array of API keys. Each key is represented as an array that includes:
apikeys($username, $password, $expired); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to get API keys!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "All API Keys for your account:\n"; foreach ($retval as $key) { echo "key = " . $key['apikey'] . "\n"; echo "\tcreated: = " . $key['created_at'] . "\n"; echo "\texpired: = " . $key['expired_at'] . "\n"; } }
new xmlrpcval($apikey), 'username' => new xmlrpcval('admin'), 'password' => new xmlrpcval('021rdb089'), 'expired' => new xmlrpcval(false) ), 'struct'); $f = new xmlrpcmsg('apikeys', 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 "All API Keys for your account:\n"; foreach ($retval as $key) { echo "key = " . $key['apikey'] . "\n"; echo "\tcreated: = " . $key['created_at'] . "\n"; echo "\texpired: = " . $key['expired_at'] . "\n"; } } else { echo "Unable to get API keys!\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" expired = False retval = api.apikeys(username, password, expired) if api.errorCode: print "Unable to get API keys!" print "\tCode=", api.errorCode print "\tMsg=", api.errorMessage else: print "All API Keys for your account:" for key in retval: print "key = ", key['apikey'] print "\tcreated: = ", key['created_at'] print "\texpired: = ", key['date_expired']