[Up]: Storage API : DropItem Accept

DropItem Accept

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

Description: Facilitate dropfile or dropfolder acceptance. (i.e. make a copy of the dropfile / folder into user's space.)

INPUT (via GET or POST)

   sid => the authenticated session id  (must be valid)

id => the dropitem id (alphanumeric)

This id identifies the specific dropfile or dropfolder from which it will be taken as the source
to copy from.

MULTIPLE ids can be specified by concatenating the individual ids together with '//' seperating them.
e.g. <id1>//<id2>//<id3>
or iDvvhfTK4DbaJAO8476ELR7YB//UnxfZAvucygODwBfm1joI04Df//o7FEw3sCfy65FDx1oP98Jknmd

tpath => targeted folder to which the dropitem will be copied to.

tpath must specify an existing folder.
The trailing "/" is not significant here.

replace => yes (to replace an existing file on the target)

By default the behaviour is NOT to replace existing file, and return an error.

ofmt => output format defaults to JSON format with minimal white spaces.
ofmt = jsonp means to produce JSON format in pretty printed way (easier to read)

OUTPUT (content-type: text/plain)


   JSON output object for general successful case, where each dropfile id gets processed.
However, the result_list needs to be inspected to see if processing result for EACH id.
result = "OK" | "FAIL" (for successful processing or not)

{
"status" : true,
"result_list" : [
{
"tpath_type" : "file",
"tpath" : "/Private HomePage/Storage Copy.txt",
"itemname" : "SomeFile.txt",
"id" : "iDvvhfTK4DbaJAO8476ELR7YB",
"comments" : "",
"isfolder" : 0,
"result" : "OK" // important to inspect this result for this id
},
{
"tpath_type" : "",
"tpath" : "/Private HomePage/",
"itemname" : null,
"id" : "UnxfZAvucygODwBfm1joI04DfX",
"comments" : "Dropfile ID does not exist anymore or is not valid.",
"isfolder" : 0,
"result" : "FAIL" // if failed, only the id and comments are meaningful.
}
]
}


JSON output object for general unsuccessful case:

{
"status" : false,
"errmsg" : "(reason for failure)"
}

e.g.
{
"status" : false,
"errmsg" : "Fail to connect to database."
}

In all cases, appropriate HTTP header status codes are also returned e.g. 200 OK, 401 Invalid user
profile, etc.