ApiFunction_get_account_tree

Page history last edited by jeremy@... 1 wk ago

get_account_tree

 



Description

 

This method is used to get a tree representing all of the user's files and folders.

 

 

Input parameters:

 

Name Type Description
api_key string The API key obtained when registering a project with OpenBox.
auth_token string The ticket obtained from get_ticket, used to authenticate a user between Box and your application.
folder_id long The ID of the root folder from which the tree begins.  If this value is "0", the user's full account tree is returned.
params ArrayOfString Allows you to set additional, optional parameters:
  • 'onelevel' - make a tree of one level depth, so you will get only the files and folders stored in the folder of the folder_id you have provided.
  • 'nofiles' - only include the folders in the user account tree, and ignore the files.
  • 'nozip' - do not zip the tree xml.
  • 'simple' - display the full tree with a limited list of attributes to make for smaller, more efficient output (folders only contain the 'name' and 'id' attributes, and files will contain the 'name', 'id', 'created', and 'size' attributes)

 

 

 

Output parameters:

 

Name Type Description
status string

If the operation was successful, the status will be 'listing_ok'

If the result was not successful, the status field can be:

  • 'application_restricted' - You provided an invalid api_key, or the api_key is restricted from calling this function

  • 'not_logged_in' - The user did not successfully authenticate on the page provided in the authentication process.

  • 'e_folder_id' - Another error occured in your call.  You may want to verify that you are using a valid folder_id, and valid params[] input.

tree base64Binary An XML structure of the tree representing the folders and files from a user's particular folder (see sample structure below).

 

 

The returned 'tree' object in the output will contain the following properties:

 

Property Type Description
folder Base64Binary An XML object representing the tree's root folder (folder object).

 



REST

 

Request

 

https://www.box.net/api/1.0/rest?action=get_account_tree&api_key=rrc1d3ntb53tt6b2vhail6rdtrsxov3v&auth_token=263gtmxiy8k8o2ebzs41pilbubvpn91g&folder_id=0&params[]=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" updated="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" updated="1129537520">
<tags>
<tag id="35" />
</tags>
</file>
</files>
</folder>
<folders>
</folder>
</tree>
</response>

 


 

Need additional assistance? Please feel free to Contact us