OpenBox Developers Blog

How To: Create Widgets from Shared Folders

Many of you have been curious about our embeddable folder widgets, and have asked our development team if it’s possible to show these widgets within your own applications.   A widget display is in fact possible to create for folders that are publicly shared, and here’s a trick to help you accomplish this.

To begin, let’s visit the API documentation site, and take a look at the public_share API method.  Notice that this method’s output includes a ‘public_name’  (similarly, there is the ’shared_link’ attribute that you obtain in the get_account_tree API method).  The ‘public_name’ is commonly used to display a shared folder by displaying a URL in the form of:

www.box.net/shared/<public_name>

These shared pages apply to both files and folders, but if the item is a folder, you can actually generate an embeddable widget as well by using the same ‘public_name’.  To see how this is possible, let’s create a widget from a shared folder manually on Box:

Getting your Embed code

Take a note of the shared link before opening the “Embed folder” popup.  In the popup, you’ll see embed code that looks like the following:

<embed src=”http://www.box.net/static/flash/box_explorer.swf?widget_hash=1maopb546fg&v=0&cl=0″ width=”460″ height=”345″ wmode=”transparent” type=”application/x-shockwave-flash”></embed>

Take a peek at the ‘widget_hash’ parameter in the embed code.  Notice anything interesting?  That widget_hash is in fact the same value you see in the folder’s shared page link!

And there’s the secret to creating widgets for shared folders.  Simply generate embed code similar to that above, and insert into the ‘widget_hash’ the value of the ‘public_name’ for the shared folder that you would like to display in the widget.  Thus, by leveraging the Box.net API, you can generate an embeddable widget for a shared folder in your own application.

We appreciate all your questions and feedback, such as those about our widgets, so remember that you can always email us if you have a question or feature request (or just post a comment to the blog).  And let us know if you have development advice from your own experience with our platform.  We’ll gladly give you an opportunity to share your experience the community.

Post by Jeremy Glassenberg, Platform Manager

New Sample Code for our Java Developers

Platform Enhancements in Progress

5 Minute Hack: Update Your Twitter Account With New Box Files

New Documentation, New Developer Rewards

Platform Profile: FireUploader

Mmmmm….Source Code

Correction of Rest and XML API call “create_folder”

New Box Enabled Blog!