4

Looking for a way to get the embed code for Box files via the API.

We have integrated Box in our app and the new embedded file/folder viewer is awesome. I'd love to give people the option to view their files/folder within our app via the embed option but need a way to get the embed code

e.g: https://www.box.com/embed/{file reference}.swf

Thanks for any info,

Dan.

2
  • I'm also interested in getting the folder embed code via the api 2.0. Commented Mar 29, 2013 at 19:18
  • <iframe src="box.com/embed_widget/000000000000/files/0/f/#{@folder.id}?view=expanded&sort=name&direction=ASC&theme=blue" width="100%" height="800" frameborder="0"> </iframe> Commented May 5, 2013 at 15:57

4 Answers 4

4

EDIT: v2 Folder Embed (requires User to be logged in)

<iframe 
src="https://box.com/embed_widget/000000000000/files/0/f/#{@folder.id}?view=expanded&sort=name&direction=ASC&theme=blue" 
width="100%" 
height="800" 
frameborder="0">
</iframe>

The Folder Embed Code does not appear to be currently supported.

See Comments from the Dev Team at the bottom of this post http://developers.blog.box.com/2012/10/11/even-more-v2-updates/

Sign up to request clarification or add additional context in comments.

Comments

2

I am currently using v1 API CreateFileEmbed http://developers.box.net/w/page/50509454/create_file_embed

Update [Sep 2013]

Box has released a public beta of View API at http://developers.box.com/view/

This is another HTML5 viewer for.

1 Comment

v1 Api Turns off on Dec 13, 2013 this function as not been migrated to v2
1

Box documentation and support is horrible. Here's what I've figured out:

# given you have your box file in a variable named "file":

result = file.api.file_embed(file.id) # this may throw Box::Api::NotShared
embed_html = result['file_embed_html'] if result.respond_to?(:[])

Unfortunately, you'll have to make sure the file is publicly shared first. There's apparently no way to do private shares in the API, from what I've found, except via email (wtf?).

For completeness, shares can be done via the api like so: (note the file.unshare method is [at the time of writing] broken, thus the call through file.api)

file.share_public
file.api.unshare_public(file.type, file.id)

1 Comment

this is outdated as of v2
0

Maybe this is old, but, This steps work for me.

First, share the file or folder with the api, next, extract the shared_link and later join with the embed url (https://app.box.com/embed_widget/000000000000/s/SHARED_LINK_VALUE).

See: Create shared foldersCreate shared filesEmbed files or folders

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.