4

寻找一种通过 API 获取 Box 文件嵌入代码的方法。

我们在我们的应用程序中集成了 Box,新的嵌入式文件/文件夹查看器非常棒。我很乐意让人们可以选择通过嵌入选项在我们的应用程序中查看他们的文件/文件夹,但需要一种获取嵌入代码的方法

例如:https://www.box.com/embed/{file reference}.swf

感谢您提供任何信息,

担。

4

4 回答 4

4

编辑:v2 文件夹嵌入(需要用户登录)

<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>

当前似乎不支持文件夹嵌入代码。

请参阅本文底部的开发团队评论 http://developers.blog.box.com/2012/10/11/even-more-v2-updates/

于 2012-10-16T20:14:54.713 回答
2

我目前正在使用 v1 API CreateFileEmbed http://developers.box.net/w/page/50509454/create_file_embed

更新 [2013 年 9 月]

Box 已在http://developers.box.com/view/上发布了 View API 的公开测试版

这是另一个 HTML5 查看器。

于 2012-10-11T01:53:23.450 回答
1

盒子文档和支持是可怕的。这是我想出的:

# 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?(:[])

不幸的是,您必须先确保该文件是公开共享的。从我发现的情况来看,显然没有办法在 API 中进行私有共享,除非通过电子邮件(wtf?)。

为了完整起见,可以像这样通过 api 进行共享:(注意 file.unshare 方法 [在撰写本文时] 已损坏,因此通过 file.api 调用)

file.share_public
file.api.unshare_public(file.type, file.id)
于 2013-03-27T19:11:31.203 回答
0

也许这是旧的,但是,这个步骤对我有用。

首先,使用 api 共享文件或文件夹,然后提取 shared_link,然后使用嵌入 url ( https://app.box.com/embed_widget/000000000000/s/SHARED_LINK_VALUE ) 加入。

See: Create shared foldersCreate shared filesEmbed files or folders

于 2013-11-06T00:02:49.037 回答