OpenBoxMobile

Page history last edited by jeremy@... 2 mos ago

Getting Started with OpenBox Mobile


 

 

Overview

 

OpenBox mobile extends the OpenBox API to provide mobile application developers with additional resources, custom to the needs of mobile development.  The OpenBox API with mobile app tools provides you with a means of freeing your content from the mobile device and to distribute your content through the cloud, with Box.net's sharing and collaboration functionality.

 

Box mobile applications leverage OpenBox to perform functions such as the following:

 

  • Export content from mobile devices to Box.net for anytime and anywhere access
  • Store and retrieve files from Box.net
  • Organize content into folders
  • Share content uploaded to and managed within Box

 

Initial Setup

 

Registration

 

Before you do anything, you'll need to go through our standard OpenBox service registration process in order to obtain a Box.net API key.  You will need to pass in your API key with every API call you make.

 

 

 

Authentication

 

Now that you have your OpenBox service set up,  you will want to get started with the API methods.  The first step to using the Box API in your code is to register and authenticate a user.  Only some mobile platforms enable developers to work with our standard authentication process, so at this point, you will likely need to contact the Box team to gain access to an altnerative login method for your application.

 

Common API Methods

 

Folder selection: create_folder and get_account_tree

 

Mobile application commonly need to provide their users with export capabilities, upload files to Box.  Before uploading, however, you will want to specify a folder in a user's account for which to upload content. 

 

Many apps establish a single folder in a user's Box account for which all content is uploaded.  This can be accomplished by calling the create_folder API method.  If you pursue this process, we recommend that you hold onto the new folder's folder_id for future reference (you'll see why when performing uploads, described below).

 

Applications also commonly display a complete list of the user's folders to let a user select the upload location.  For this experience, you can use the get_account_tree API method. This call retrieves an XML document describing the entire contents of the user's box, including files and folders. You can also pass the ID of a folder as a parameter to this call, enabling your application to retrieve only the content of a particular folder.

 

Optimizing code

 

API methods such as get_account_tree can return large amounts of data for Box.net's power users, which can result in poor performance for mobile devices on mobile data connections.  In order to alleviate this issue, we provide optional parameters for API calls to compress output, or limit output to only the content you need.  For instance, the following tricks will help to optimize calls to get_account_tree:

 

  • '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.  Many applications call get_account_tree one level at a time, only obtaining a sub-level when a user chooses to enter a sub-folder.
  • 'nofiles' - only include the folders in the user account tree, and ignore the files.  For example, when prompting a user to select a folder for which to upload content, you only need to display the folders, not the files.
  • 'simple' - display the full tree without all the details (thumbnails, shared status, tags, and other attributes are left out).
  • 'folder_id' - a required parameter, but one which can immensely speed your calls if used properly.  It's easy to obtain a full account tree by specifying the folder_id as '0', but if you have a designated folder for your application, you can store that folder_id and only retrieve the tree for your folder.

 

Uploading content

 

To upload a file, your application can perform an HTTP POST to a URL of the form:

 

 

At the time you upload a file using HTTP POST, you can also specify whether you want the file to be publicly sharable, and even specify email addresses with whom to share the content upon upload. More information on upload methods can be found at the uploading and downloading instructional page.  

 

All functions available to you with our API can be found on the sidebar to your right (go back to the top).

 

Supportive code

 

For iPhone developers, we have provided a set of sample code in Objective-C.  This code can be downloaded from our sample code & libraries page.

 

We are continuing to enhance that code sample, as we also pursue more supportive tools for other mobile platforms, including BlackBerry and Palm.

 


 

Need additional assistance? Please feel free to Contact us