View Source

Use the {{addDevicesToDiskSafe}} API to add devices to the entered Disk Safe.
{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="ec04cd66-aef7-491e-852c-2bb81446de1f";

#sample Device class
Class Device{
public $contentID;
public $mountPoint;
public $enabled;
}

$newDevice = new Device();
$newDevice->mountPoint = "/extraDisk"; # the device object can have either mount point or contentID
$newDevice->enabled = true; # default state for this property is true

/*$newDevice1 = new Device();
$newDevice1->contentID = "587C436D7C43454A";# the device object can have either mount point or contentID
$newDevice->enabled = false;
*/
#sample DiskSafe class
Class DiskSafe{
public $id;
public $diskSafeAttributeMap;
}
$diskSafe = new DiskSafe();
$diskSafe->id = "bcf0a572-e92c-43b1-8fcf-be2b4a1f395b"; # example disksafe id
$diskSafe->diskSafeAttributeMap =array();
#Add devices to the entered disk safe.
try{

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

$response = $client->addDevicesToDiskSafe(array('diskSafe'=>$diskSafe, 'deviceList'=>array($newDevice))) ;

var_dump($response);

echo "Successfully executed addDevicesToDiskSafe\n";
}
catch (SoapFault $exception)
{
echo $exception;
}
{code}