Delete a storage folder in PHP using Aspose.Storage REST API issue

Hello Aspose Support,

We are facing an issue with the PHP SDK that previously we didn’t face with the deprecated Laravel Package.

The issue that when we create a folder and inside it files, and then we use the code example of deleteFolder, it throws this exception (attached), but when the folder is empty and have no files it didn’t throw any exception.

Also we tried with the flag of recursive and without it, and same exception happens.screenshot_from_2018-03-05_10-04-55.png (26.9 KB)

Let us know if you need more details to replicate the issue.

Thanks.

@Softwareselskabet

Thank you for contacting Aspose Support.

Problem is not with the delete /storage/folder API. Following Postman example successfully delete the folder with files.

We are testing Aspose.Storage Cloud SDK for PHP for the reported issue and will update you shortly about our findings.

@Softwareselskabet

The issue has been fixed. Please download aspose/storage-sdk-php package version 1.0.1.

@Softwareselskabet

Please note, since Aspose.Words Cloud 19.4 version, we have integrated storage methods in Aspose.Words Cloud API. Now you do not need to use Aspose.Storage Cloud API for storage operations. Please find sample PHP code for folder deletion as follows. You may check Aspose.Words Cloud SDK for PHP for more details.

<?php
    require_once('C:\xampp\htdocs\aspose-words-cloud-php-master\vendor\autoload.php');

//require __DIR__.'/../vendor/autoload.php';

use Aspose\Words\Configuration;
use Aspose\Words\WordsApi;
use Aspose\Words\Model\Requests;

//TODO: Get your AppSID and AppKey at https://dashboard.aspose.cloud (free registration is required).

$words = new WordsApi('xxxxx-xxxx-xxxx-xxxx-xxxxxxxx','xxxxxxxxxxxxxxxxxxxxxxx');

try {	
	$folderPath="Temp/Test";
	//using default storage
	$storage_name = null;
	//Enable to delete folders, subfolders and files
    $recursive = True;
	
	$request = new Requests\DeleteFolderRequest($folderPath,$storage_name,$recursive);
    $result = $words->deleteFolder($request);
    	
	print_r($result);
	
    echo "Completed!!!!";
    
} catch (Exception $e) {
    echo  "Something went wrong: ",  $e->getMessage(), "\n";
    PHP_EOL;
}

?>