1. API Referenceのありか
http://<R1SoftServer>/apidoc
にある。
2. Sample APIの場所
例えばライセンス情報を取得するためのサンプルAPIは以下に載っている。
http://wiki.r1soft.com/display/ServerBackup/getServerInformation
3. Sample APIの使い方
このサンプルは全部phpなので、まずはphpを導入する必要がある。
[root@myr1soft ~]# yum install -y php.x86_64 php-soap.x86_64
SampleAPIを適当なファイルに保存し(例えばgetServerLicenseInformation.php
など)、
-
$HOST
と$PASS
を適切なIPアドレスおよびパスワードに変更する。 - phpスクリプトとしてとして動かすために、最初と最後に
<?php
と?>
を挿入する。
getServerLicenseInformation.php
<?php
########====CDP Server Configuration Start====########
#set CDP server host name
$HOST="xxxxxxx";
#set CDP server to access API
$PORT="9443";
#set CDP user
$USER="admin";
#set CDP user password
$PASS="xxxxxxx";
########====CDP Server Configuration End====########
#Retrieve license details for your host server.
try{
$client = new soapclient("https://$HOST:$PORT/Configuration?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'trace'=>1
)
);
$response=$client->getServerLicenseInformation() ;
var_dump($response);
echo "Successfully executed getServerLicenseInformation\n";
exit(0);
}
catch (SoapFault $exception)
{
echo $exception;
exit(1);
}
?>
4. 実行例
[root@myr1soft ~]# php getServerLicenseInformation.php
object(stdClass)#2 (1) {
["return"]=>
object(stdClass)#3 (18) {
["advancedEdition"]=>
bool(false)
["currentAgentCount"]=>
int(0)
["currentLongTermArchiveCount"]=>
int(0)
["currentVirtualAgentCount"]=>
int(0)
["currentVirtualizationCount"]=>
int(0)
["enterpriseEdition"]=>
bool(true)
["licenseAgentCount"]=>
int(10)
["licenseKey"]=>
string(36) "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
["licenseVirtualAgentCount"]=>
int(0)
["pooledLicense"]=>
bool(true)
["standardEdition"]=>
bool(false)
["timeLimitReportEnabled"]=>
bool(false)
["timeLimited"]=>
bool(false)
["totalLongTermArchiveCount"]=>
int(0)
["totalVirtualizationCount"]=>
int(0)
["trial"]=>
bool(false)
["valid"]=>
bool(true)
["version"]=>
string(5) "6.6.1"
}
}
Successfully executed getServerLicenseInformation