[Up]: Storage API : Shared Folder listing

Shared Folder Listing

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

Description: Returns the list of items shared to OR shared by the authenticated user.

INPUT (via GET or POST)

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

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

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

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,

"list_to_user" :
count => N, the number of items in this list
list => [
{ items shared TO this authenticate user FROM others }, ... sorted by share_name
],


"list_from_user" :
count => N, the number of items in this list
list => [
{ items shared FROM (by) this authenticate user TO others }, ... sorted by share_path
],

}

-----

Each of the shared item is a JSON object of this form:

{

"share_id" : the shared item ID (alphanumeric)

"share_to_profile_is_valid" : true | false -- whether the share-to user info is valid or not
"share_to_email_id" : the share-to user's id (or internal id)
"share_to_real_email" : the share-to user's email (user email address)
"share_to_fullname" : the share-to user's fullname, if any

"share_from_user_is_valid" : true | false -- whether the share-from user info is valid or not
"share_from_email_id" : the shared item's user's id (internal id)
"share_from_real_email" : the shared item's user's email (user email address)
"share_from_fullname" : the shared item's user's fullame, if any

"shared_item_is_valid" : true | false -- whether the folder is still available from owner
"share_path" : the storage path to the item (for now is only folder)
"share_path_basename" : the item's basename (the last component of spath)

"share_name" : shared as this name (The shared to user will see this, set by owner)

"read_access" : "yes" | "no"
"write_access" : "yes" | "no"

}

Appropriate HTTP header status codes are also returned e.g. 200 OK, 401 Invalid user profile, etc.


Examples:

For a user who was NOT shared any folder (by anyone), the output would look like this:
{
"list_to_user" : {
"count" : 0,
"list" : []
},
"status" : true,
"errmsg" : ""
}


An example with a user who has a couple of shared folders from others:
{
"list_to_user" : {
"count" : 2,
"list" : [
{
"read_access" : "yes",
"share_path_basename" : "Happy Folder",
"share_to_user_is_valid" : true,
"shared_item_is_valid" : true,
"write_access" : "yes",
"share_from_email_id" : "pojen@noc.afteroffice.com",
"share_to_fullname" : "SS Chan",
"share_from_fullname" : "Pojen",
"share_name" : "Happy Folder",
"share_path" : "/Private/Happy Folder",
"share_to_email_id" : "sschan@noc.afteroffice.com",
"share_to_real_email" : "sschan@noc.afteroffice.com",
"share_from_user_is_valid" : true,
"share_id" : "eZt8x3kHdKFNvyHSeY2lNBTnuwipm9FB3eJgCvJr",
"share_from_real_email" : "pojen@noc.afteroffice.com"
},
{
"read_access" : "yes",
"share_path_basename" : "大小",
"share_to_user_is_valid" : true,
"shared_item_is_valid" : true,
"write_access" : "no",
"share_from_email_id" : "fui@noc.afteroffice.com",
"share_to_fullname" : "Sian Sit Chan",
"share_from_fullname" : "Fui 2",
"share_name" : "大小BigSmall",
"share_path" : "/Private/大小",
"share_to_email_id" : "sschan@noc.afteroffice.com",
"share_to_real_email" : "sschan@noc.afteroffice.com",
"share_from_user_is_valid" : true,
"share_id" : "QIC3pFF5ULsLbSsW9QwFBQVwPrExEUDLM4Rjgetf",
"share_from_real_email" : "fui@noc.afteroffice.com"
}
]
},
"status" : true,
"errmsg" : ""
}