Use the {{deleteAgentById}} API to delete a Backup Agent from the entered host server. Identify the Backup Agent by its 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 = "19d014d3-4995-4ad2-bfdd-e3d57bb1f2f3";
#Delete a 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
)
);
$client->deleteAgent(array('agent'=>$agent));
echo "Successfully executed deleteAgent\n";
exit(0);
}
catch (SoapFault $exception)
{
echo $exception;
}
{code}
{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 = "19d014d3-4995-4ad2-bfdd-e3d57bb1f2f3";
#Delete a 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
)
);
$client->deleteAgent(array('agent'=>$agent));
echo "Successfully executed deleteAgent\n";
exit(0);
}
catch (SoapFault $exception)
{
echo $exception;
}
{code}