Slides for Cloud API "Can't read file"


#1

I am using PHP to access the API. I am using the following code:


$storageApi = new StorageApi();
$slidesApi = new SlidesApi();
$apiClient = new APIClient();

$storage = “spotify_cmo_mmd”;
$master = “Sample_spot_01.pptx”;
$clone = “clone2.pptx”;
$test = array(2,3);
try {
//upload file to aspose cloud storage
//$result = $storageApi->PutCreate($fileName, “”, $storage, getcwd() . ‘/assets/’ . “Clone.pptx”);

//invoke Aspose.Slides Cloud SDK API
$response = $storageApi-> GetIsExist($master, “”, “”);
//echo “

Cloned

”;

if ($response != null && $response->Status = “OK”) {
echo “Master File Ready
”;

$response = $storageApi->PutCopy($master, $clone, “”, “”, “”, $master);
if ($response != null && $response->Status = “OK”) {
// $response = $storageApi-> GetIsExist($clone, “”, “”);
// if ($response != null && $response->Status = “OK”) {
echo “Master Cloned
”;
echo “Preparing to edit
”;
$response = $slidesApi->DeleteSlideByIndex($clone,2,"",“aspose”);
// print_r($response);
// }
foreach ($test as $x) {
// $response = $slidesApi->DeleteSlideByIndex($clone,$x,"","");
}
$result = $storageApi->GetDownload($clone);

$apiClient->saveFile($result, getcwd() . “/output/” . $clone);
echo “clone saved on server”;
}
}
} catch (\Aspose\Words\ApiException $exp) {
echo “Exception:” . $exp->getMessage();
}

I get to DeleteSlideByIndex and I get a 400 error and the message “can’t read file”. I’ve established that the file exists with GetIsExist, but it is not allowing me to access the slide to remove a page.


#2

Hi Brian,


We are looking into this and will get back to you with feedback soon.

Best Regards,

#3

Hi Brian,

I have observed the sample code shared by you. In your code, you are trying to use storage “aspose” in the line
$response = $slidesApi->DeleteSlideByIndex($clone,2,"",“aspose”);

However, you didn’t use this storage before in the code in following line:

$storageApi-> GetIsExist($clone, “”, “”);

You are trying to check file in the default storage. Please try the same storage in your sample code.

Many Thanks,