API Update: Optimizing get_account_tree
Many of our more complex API methods are designed for flexibility, so that you can request exactly the content you need, and only the content you need. For example, the get_account_tree method allows you to customize and optimize your request by specifying optional parameters. If you just want to display a folder tree so that a user can select a folder, you can specify ‘nofiles’ in the API call in order to avoid receiving a full tree of the user’s files. And many developers leverage our “onelevel” option to ignore the subfolders in an account hierarchy, be it to search for a file that they know is at the top of a folder, or to just speed up the display of a folder to their users by refraining from obtaining the subfolder content.
To further assist developers who just need to know what’s in the account tree, but don’t need to have every detail for each folder and file, we have a new optional parameter - ’simple.’ This allows you to obtain everything that is normally received from a call to ‘get_account_tree’, but doesn’t give every detail such as the time of a a file’s description, a folder’s sharing status, and other information of which many developers enjoy having access, but which you may not need.
An ordinary get_account_tree call could inlcude a folder listing that looks something like this:
<folder id="4584" name="Sample folder" description="" user_id="3358104" shared="1"
shared_link="http://www.box.net/shared/im1n45dfe" permissions="denpsuv" size="156427"
file_count="1" created="1219270561" updated="1240208378">
<tags/>
<files>
<file id="62787" file_name="silver.doc" keyword="" shared="0" size="15805"
created="1129544520" updated="1129568520" sha1="..." description="" user_id="..."
shared_link="http://www.box.net/..." thumbnail="http://www.box.net/..."
small_thumbnail="http://www.box.net/..." large_thumbnail="http://www.box.net..."
larger_thumbnail="http://www.box.net/..." preview_thumbnail="http://www.box.net/..."
permissions="denpsuv">
<tags>
<tag id="35" />
</tags>
</file>
</files>
</folder>
If you choose to specify “params[]=simple” you’ll be able to instead obtain a tree like this:
<folder id="4584" name="Sample Folder">
<files>
<file id="62787" file_name="silver.doc" size="15805"
created="1129544520"></file>
</files>
</folder>
This addition should be especially helpful for mobile applications that intend to display a full account tree but, rely on slower internet connections and have less screen space for which to display detailed content anyway. You can now obtain the user’s account tree while leaving out a good chunk of data, saving time and resources for your users.
Thank you to the members of the development community who requested this small addition to our API.
Post by Jeremy Glassenberg, Platform Manager

