View Source

Use the {{updateAgent}} API to update the Backup Agent with the most current values.
{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";
#Update the Backup Agent with the most current values.
try{
$client1 = 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=$client1->getAgents();
//var_dump($agentObj);
}
catch (SoapFault $exception)
{
echo $exception;
exit(1);
}

foreach($agentObj->return as $tmp)
{
if($tmp->id == $AGENTID)
{
$agent = $tmp;
break;
}
}

#### Current properties ####
var_dump($agent);
#### Current properties ####

#### change to the agent object ####
##$agent->ownerId = "abfc1f95-dfd9-46a0-9df8-3b371eae3003";
##
#make this an array to add more permissions
##
$agent->ownerPermissions=array("CAN_RESTORE","CAN_EDIT_POLICIES","CAN_EDIT_AGENT");
$agent->description="updatedDesc";
#### change to the agent object ####


try{
$client = new soapclient("https://$HOST:$PORT/Agent?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
)
);

$client->updateAgent(array('agent'=>$agent));

echo "Successfully executed updateUser\n";

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