[Up]: Storage API : Rename

Rename

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

Description: Renames a file or folder.

INPUT (via GET or POST)

Mandatory parameters are: sid, path, newname
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  - renaming the file MyFile.avi in "Private" area
path=/Company Share/Archive/Data/ - renaming folder Data.

 

newname = <newname>
The new name to use.

For acceptable names, refer to [Name restriction]

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
}


Unsuccessful return:

	false <tab> <error message> <newline>

        e.g.

	false <TAB> New name is invalid. (illegal character, too long, etc.)

       Equivalent JSON output would look like the following:

	{
"http_status" : "400 Unable to rename item",
"status" : false,
"errmsg" : "New name is invalid. (illegal character, too long, etc.)"
}

   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.