Home > Developer > Lookafter Storage System API > GetItemInfo
Script path: /storage/bin/api/get_item_info.cgi
Description: Returns information about an item (file or folder). Information you want to retrieve is specified using the fields parameter, which is a string consisting of comma separated field names.
Mandatory parameters are: sid, path
Optional parameters are: fields, ofmt
Session id of the login user. [mandatory]
Path to a folder. [mandatory]
Please refer to How to specify a path.
Path must point to an existing folder. E.g.:
= name,date,dategmt,mtime,size,type,owner,company,lock,description,checksum,lock_owner,ucar
= name,date,size,type (this is default if no fields are provided)
The field names may be any order and the returned field values will follow that order. Separate the field names with commas but do not include any spaces. Fields obmitted will not be returned. Returned value for a field can be empty strings. If a field does not exist in the item's information record, an empty field is returned. WARNING: a misspelled field name will be quietly ignored, i.e. returned empty value!
Output format
= json means to return output in JSON format (with minimum or no redundant white spaces)
= jsonp means to return ouput in JSON format, pretty-printed for easy human readability.
otherwise (default, or not specified), means the legacy “flat” formatting output is assumed.
In the legacy “flat” output format, the returned value for ucar is in a “flat” not pretty-printed JSON object string. It cannot be pretty-printed because it will break the flat format. In a JSON output formt, the returned value for ucar is also a JSON object nested in overall JSON object, and can be pretty-printed as requested.
Successful return:
true <newline> <tab separated field values for the item> <newline>
e.g.
true newfolder <TAB> 20010206180115 <TAB> 0 <TAB> folder
Unsuccessful return:
false <tab> <error message> <newline>
e.g.
false <TAB> Item does not exist.
Successful return:
JSON output object: { "status" : true, "item_info" : { "property1" : "value1", "property2" : "value2", "property3" : "value3", ... } } Most of field values will be represented simply as "fieldname":"simple-value" pair, in the root "item_info" property. For field value of "ucar", a sub-JSON object will represent it. (A sample is shown below.) "ucar" : { <taskKeyword>: { "level":<integer>, "groups":{ <groupname>:<0/1>,... }, "taskdescription":<desc-of-task> }, <taskKeyword>: { "level":<integer>, "groups":{ <groupname>:<0/1>,... }, "taskdescription":<desc-of-task> }, <taskKeyword>: { "level":<integer>, "groups":{ <groupname>:<0/1>,... }, "taskdescription":<desc-of-task> }, : }
Unsuccessful return:
JSON output object: { "status" : false, "errmsg" : "error message, if status is false" }
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.
A full sample of a JSON object returned:
{ "item_info" : { "owner" : "sschan", "ucar" : { "listFolderContent" : { "level" : "10", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 0, "user" : 1, "guest" : 0, "management" : 0 }, "taskdescription" : "List Folder Content" }, "createFiles" : { "level" : "10", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 0, "user" : 1, "guest" : 0, "management" : 0 }, "taskdescription" : "Create Files in Folder" }, "deleteFilesInFolder" : { "level" : "1", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 0, "user" : 0, "guest" : 0, "management" : 0 }, "taskdescription" : "Delete Files in Folder" }, "deleteFolder" : { "level" : "1", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 0, "user" : 0, "guest" : 0, "management" : 0 }, "taskdescription" : "Delete Folder" }, "createSubfolder" : { "level" : "1", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 0, "user" : 1, "guest" : 0, "management" : 0 }, "taskdescription" : "Create Subfolder" }, "writeFilesInFolder" : { "level" : "1", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 0, "user" : 0, "guest" : 0, "management" : 0 }, "taskdescription" : "Write to Files in Folder" }, "readFilesInFolder" : { "level" : "2", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 1, "user" : 0, "guest" : 0, "management" : 1 }, "taskdescription" : "Read Files in Folder" }, "seeThisFolder" : { "level" : "10", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 0, "user" : 1, "guest" : 0, "management" : 0 }, "taskdescription" : "See Folder (Visible)" }, "editUcarSetting" : { "level" : "1", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 0, "user" : 0, "guest" : 0, "management" : 0 }, "taskdescription" : "Update UCAR Setting" }, "renameFilesInFolder" : { "level" : "1", "groups" : { "admin" : 1, "account" : 0, "sales" : 0, "order" : 0, "user" : 0, "guest" : 0, "management" : 0 }, "taskdescription" : "Rename Files in Folder" }, "renameFolder" : { "level" : "6", "groups" : { "admin" : 1, "account" : 1, "sales" : 0, "order" : 0, "user" : 0, "guest" : 0, "management" : 1 }, "taskdescription" : "Rename Folder" } }, "lock" : "no", "mtime" : 1359626401, "date" : "20130131180001", "name" : "myfolder", "description" : "Description of the item", "size" : 0, "checksum" : "", "lock_owner" : "", "dategmt" : "20130131100001", "type" : "folder", "company" : "noc.afteroffice.com" }, "status" : true }
For a brief explanation of what the ucar settings mean, first note that ucar only applys to a folder item (and in a shared folder like Company Share or Company HomePage). The JSON object has as first level of name/value pairs keyed on ucar tasks names like “renameFolder”, “listFolderContent”, etc. The value of each of these tasks is another JSON object with three name/value pairs, namely “level”, “groups”, and “taskdescription”. Level is the numeric level assigned to the associated task. A user must have a user level lower that this to have the permission to do the task on the folder. Groups has yet another JSON object defining which user group has permission to do the task on the folder. It is a yes/no permission for users in that group to do the task. Either level privilege or group privilege is sufficient to grant permission when both rules are taken together.