[Up]: Storage API : Delete

Delete

Script path: /storage/bin/api/delete.cgi

Description: Deletes a file or folder (and all its content).

INPUT (via GET or POST)

Mandatory parameters are: sid, path
Optional parameters are: ofmt

sid session id of the login user. [mandatory]
path path to an item [mandatory]

Please refer to [How to specify a path].

path must point to an existing file or folder.

e.g.
path=/Private/MyFile.avi  - delete the file MyFile.avi in "Private" area
path=/Company Share/Archive/Data/ - delete folder Data and all its content.

Multiple path paramters can be specified to delete multiple items in one go. (Be careful!). Internally the items are deleted one at a time and if an error is encountered while deleting an item, the process will abort leaving the remaining items not deleted. Only upon successfully deleting ALL items, then there will be a successful response. So, in case of error during multiple deletions, some item may have already been deleted.

Specify each of the multiple path parameter in full path format. e.g.  path=/Private/File.txt&path=/Company+Share/Video.avi

 

ofmt
= null | json | jsonp
   null is the default, and the legacy "flat" output format is returned.
   json means the output format is in JSON format
   jsonp is like json, but in "pretty" form for easier human readability.

OUTPUT (content-type: text/plain)

Successful return:

	true <newline>

          Equivalent JSON output would look like the following:

	{
"status" : true
}

         NOTE: If an item does not exist, the API returns successful, as if it existed and got deleted!


Unsuccessful return:

	false <tab> <error message> <newline>

        e.g.

	false <TAB> Access denied. (Or item may be locked)
	false <TAB> Unable to delete an item within.

       This last message means that while deleting an entire folder, one or more file or subfolder within could not be deleted.
       This cause the folder to remain in existence.

       Equivalent JSON output would look like the following:

	{
"http_status" : "400 Unable to delete item",
"status" : false,
"errmsg" : "Access denied. (Or item may be locked)"
}

	{
"http_status" : "400 Unable to delete item",
"status" : false,
"errmsg" : "Unable to delete an item within."
}

   In both legacy "flat" output and also JSON output, appropriate HTTP header status codes are also returned e.g. 200 OK, 401 Invalid user profile, etc.