View Source

Use the {{getDevicesFromAgent}} API to retrieve a list of devices from the Backup Agent based on the GUID.
{code}
########====CDP Server Configuration Start====########
#set CDP server host name
$HOST="10.230.131.25";
#set CDP server to access API
$PORT="9443";
#set CDP user
$USER="admin";
#set CDP user password
$PASS="admin";
########====CDP Server Configuration End====########

$AGENTID = "407299a0-ef82-44a1-b496-047deb9c7ccf";
#Retrieve a list of devices from the Backup Agent based on the entered GUID.
try{
$client = new soapclient("https://$HOST:$PORT/Agent?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'cache_wsdl' => WSDL_CACHE_NONE,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
'trace'=>1
)
);

$agentObj=$client->getAgents();
}

catch (SoapFault $exception)
{
echo $exception;
echo(1);
}

foreach($agentObj->return as $tmp)
{
if($tmp->id == $AGENTID)
{
$agent = $tmp;
break;
}
}
try{
$client = new soapclient("https://$HOST:$PORT/Agent?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
)
);

$response = $client->getDevicesFromAgent(array('agent'=>$agent)) ;
var_dump($response);
echo "Successfully executed getDevicesFromAgent\n";

}
catch (SoapFault $exception)
{
echo $exception;
}
{code}