get_account_tree

 

input parameters:

  • api_key: string
  • sid: string
  • folder_id: long
  • params: ArrayOfString

 

output parameters:

  • status: string
  • tree: base64Binary

 

This method is used to get a user's files and folders tree.

 

'folder_id' defines the root folder from which the tree begins.

'params' is an array of string where you can set additional parameters, which are:

  • onelevel - make a tree of one level depth, so you will get only files and folders stored in folder which folder_id you have provided.
  • nofiles - include folders only in result tree, no files.
  • nozip - do not zip tree xml.

 

On a successful operation you will receive 'listing_ok' as the status and base64 encoded zipped tree xml.

You will have to decode the received tree, and then unzip it (if you haven't set 'nozip' param). You will then get xml content like this:

(note that 'updated' and 'created' are UNIX timestamps in PST)

<?xml version="1.0" ?>
<folder id="0" name="" shared="0">
  <tags></tags>
  <files></files>
  <folders>
     <folder id="4384" name="Incoming" shared="0">
        <tags>
           <tag id="34" />
         </tags>
         <files>
            <file id="68736" file_name="cows.w3g" keyword="" shared="0" size="232386"
            created="1129537520" updated="1129537520">
               <tags>
               </tags>
            </file>
            <file id="68737" file_name="silver.html" keyword="" shared="0" size="15805"
            created="1129537520" updated="1129537520">
               <tags>
                  <tag id="35" />
               </tags>
            </file>
         </files>
      </folder>
   <folders>
</folder>
 

 

Parameters for the folder tags may include:

  • id - a unique id for the folder
  • name - the name of the folder
  • user_id - the id of the user who owns the folder
  • description - the folder's description (can be empty, the owner chooses whether to add a description)
  • shared - whether this folder is being shared with others to view ("0" for private, "1" for shared)
  • shared_link - a URL to share with others to view the folder
  • permissions - provides information regarding a user's access permissions. If the value is "densuv" that means that the user has full permissions. "d" represents downloading rights, "e" delete rights, "n" for rename, "s" for share, "u" for upload, and "v" for view.
  • role - this will display "owner" if the folder was explicitly collaborated by the user.

 

Parameters for the file tags may include:

  • id - a unique id for the file
  • file_name - the name of the file
  • user_id - the id of the user who owns the file
  • description - the file's description (can be empty, the owner chooses whether to add a description)
  • shared - whether this file is being shared with others to view ("0" for private, "1" for shared)
  • shared_link - a URL to share with others to view the file
  • created - a unix timestamp for the time in which the file was created
  • updated - a unix timestamp for the most recent time in which the file was updated
  • size - the size of the file in bytes

 

If result wasn't successful status can be:

  • 'not_logged_id'
  • 'application_restricted'
  • 'e_folder_id'

 

REST

 

Request

www.box.net/api/1.0/rest?action=get_account_tree&api_key=rrc1d3ntb53tt6b2vhail6rdtrsxov3v&auth_token=263gtmxiy8k8o2ebzs41pilbubvpn91g&folder_id=0¶ms[]=nozip

 

Response

<?xml version='1.0' encoding='UTF-8'?>
<response>
 <status>listing_ok</status>
 <tree>
  <folder id="0" name="" shared="0">
   <tags></tags>
   <files></files>
   <folders>
    <folder id="4384" name="Incoming" shared="0">
     <tags>
      <tag id="34" />
     </tags>
   <files>
    <file id="68736" file_name="cows.w3g" keyword="" shared="0" size="232386"
    created="1129537520" updated="1129537520">
     <tags> </tags>
    </file>
    <file id="68737" file_name="silver.html" keyword="" shared="0" size="15805"
    created="1129537520" pdated="1129537520">
     <tags>
      <tag id="35" />
     </tags>
    </file>
   </files>
  </folder>
   <folders>
  </folder>
 </tree>
</response>
 

 

SOAP

 

Request

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:tns="urn:boxnet" xmlns:types="urn:boxnet/encodedTypes"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
    <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <tns:get_account_tree>
            <api_key xsi:type="xsd:string">rrc1d3ntb53tt6b2vhail6rdtrsxov3v</api_key>
            <sid xsi:type="xsd:string">4628c8c9c4b86c22567e53d215ecdc79</sid>
            <folder_id xsi:type="xsd:long">0</folder_id>
            <params href="#id1" />
        </tns:get_account_tree>
        <soapenc:Array id="id1" soapenc:arrayType="xsd:string[0]" />
    </soap:Body>
</soap:Envelope>

Response

 <SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:ns4="urn:boxnet"
 SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
  <SOAP-ENV:Body>
    <ns4:get_account_treeResponse>
      <status xsi:type="xsd:string">listing_ok</status>
      <tree xsi:type="xsd:base64Binary">


PD94bWwgdmVyc2lvbj0iMS4wIj8+PGZvbGRlciBpZD0iMCIgbmFtZT0iIiBzaGFyZWQ9IiIgc2hhcmVkX2xpbms9IiIgP
jx0YWdzPjwvdGFncz48ZmlsZXM+PGZpbGUgaWQ9IjI3OTEiIGZpbGVfbmFtZT0iMS5naWYiIHNoYXJlZD0iMCIgY3JlYX
RlZD0iMTE1NzUzODcwOSIgdXBkYXRlZD0iMTE2MTU5MTMxNSIgc2l6ZT0iNTA1IiBzaGFyZWRfbGluaz0iIiAgPjx0YWd
zPjwvdGFncz48L2ZpbGU+PC9maWxlcz48L2ZvbGRlcj4=
      </tree>
    </ns4:get_account_treeResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope><br>

 

XML

 

Request

<?xml version='1.0' encoding='UTF-8' ?>
<request>
    <action>get_account_tree</action>
    <api_key>rrc1d3ntb53tt6b2vhail6rdtrsxov3v</api_key>
    <auth_token>263gtmxiy8k8o2ebzs41pilbubvpn91g</auth_token>
    <folder_id>0</folder_id>
    <params />
</request>

Response

<?xml version='1.0' encoding='UTF-8'?>
<response>
 <status>listing_ok</status>
 <tree>
  <folder id="0" name="" shared="0">
   <tags></tags>
   <files></files>
   <folders>
    <folder id="4384" name="Incoming" shared="0">
     <tags>
      <tag id="34" />
     </tags>
   <files>
    <file id="68736" file_name="cows.w3g" keyword="" shared="0" size="232386"
    created="1129537520" updated="1129537520">
     <tags> </tags>
    </file>
    <file id="68737" file_name="silver.html" keyword="" shared="0" size="15805"
    created="1129537520" pdated="1129537520">
     <tags>
      <tag id="35" />
     </tags>
    </file>
   </files>
  </folder>
   <folders>
  </folder>
 </tree>
</response>


 

Need additional assistance? Please feel free to Contact us


Page Information

  • 2 months ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts