[Up]: Storage API : DropBox Listing

DropBox Listing

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

Description: Returns the list of items dropped to the authenticated user. It can also list the items dropped by the authenticated user.

INPUT (via GET or POST)

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

to_user = 0 | 1 (default is 1)
List out items dropped to this authenticated user (by others)
(This will be listed if to_user is specifically turned off.)

from_user = 0 | 1 (default is 0)
List out items dropped by this authenticated user to others

sortby = date | size | from | filename | expiry
(default is date i.e. date & time the drop was done NOT the file's date)

sorthow = acend | decend (default is decend)

Sorting parameters apply similar to both to_user and from_user lists at the same time.

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:

{
"status" : true | false,
// true only if the API completes successfully
// false if otherwise

"errmsg" : error message, if status is false,
"errcode" : internal error code (alphanumeric) only if in case of error,

"to_user" :
count => N, the number of items thislist
list => [
{ dropitem "sent" TO this authenticate user }, ...
],


"from_user" :
count => N, the number of items thislist
list => [
{ dropitem "sent" FROM (by) this authenticate user }, ...
],

}

-----

Each of the dropitem is a JSON object of this form:

{
"id" => the dropitem ID (alphanumeric)

"date" => the date/time when the drop was done (adjusted to user's timezone)
"date_gmt" => the date/time when the drop was done (GMT)

"expiry" => the date/time when the drop will expire (adjusted to user's timezone)
"expiry_gmt" => the date/time when the drop will expire (GMT)

"to_email" => the drop recipient's email address (or internal userid)
"to_email_fullname" => recipient's fullname, if any

"from_email" => the drop sender's email address (or internal userid)
"from_email_fullname" => recipient's fullname, if any

"spath" => the storage path to the item (could be a file or a folder)
"itemname" => the item's basename (the last component of spath)

"is_folder" => false | true

"desc" => the description of the item at the time of the drop

"size" => the size of the item at the time of the drop (if folder, the total file size it contains)

"pickup_url" : The URL that the recipient will use to access/download the dropitem

"passphrase" : The passphrase set for this dropitem, if any
}

Examples:

An empty user's drop box looks like this:
{
"to_user" : {
"count" : 0,
"list" : []
},
"status" : true,
"errmsg" : ""
}

An example with a list of two items dropped to the user:
{
"to_user" : {
"count" : 2,
"list" : [
{
"from_email" : "user1@noc.afteroffice.com",
"expiry" : "2013-12-28 22:21:09",
"itemname" : "filename.txt",
"date" : "2013-12-23 22:21:09",
"is_folder" : false,
"to_email_fullname" : "SS Chan",
"expiry_gmt" : "2013-12-28 14:21:09",
"from_email_fullname" : "User One",
"to_email" : "sschan@noc.afteroffice.com",
"size" : 522,
"desc" : "",
"spath" : "/Private/testfolder/filename.txt",
"id" : "eaptnobSt667TyGciwJDGtAww",
"date_gmt" : "2013-12-23 14:21:09"
"pickup_url" : "http://192.168.1.85/file/eaptnobSt667TyGciwJDGtAww",
"passphrase" : "Open Sesame!"
 },
{
"from_email" : "user1@noc.afteroffice.com",
"expiry" : "2013-12-28 22:20:42",
"itemname" : "subfolder",
"date" : "2013-12-23 22:20:42",
"is_folder" : true,
"to_email_fullname" : "Sian Sit Chan",
"expiry_gmt" : "2013-12-28 14:20:42",
"from_email_fullname" : "User One",
"to_email" : "sschan@noc.afteroffice.com",
"size" : 270,
"desc" : "",
"spath" : "/Private/testfolder/subfolder",
"id" : "MgSaIRqpwbw2DvRCK2S7lqO73",
"date_gmt" : "2013-12-23 14:20:42"
"pickup_url" : "http://192.168.1.85/file/MgSaIRqpwbw2DvRCK2S7lqO73",
"passphrase" : "It's raining in $pain!"
 },
]
},
"status" : true,
"errmsg" : ""
}

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