Dropbox API v1 to v2 regarding direct link

有些话、适合烂在心里 提交于 2019-11-29 17:20:23

The link returned by API v2 is also a direct link (i.e., it returns the file data directly). However, it sets the Content-Disposition to "attachment", so browsers will download it. There isn't an option for controlling this though.

With v2 API, you can use a URL such as this:

https://content.dropboxapi.com/2/files/download?authorization=Bearer ACCESS_TOKEN&arg={"path":"/PATH/TO/THE/FILE"}

(encode the URL parameters properly)

In Javascript, it will be something like this:

var token = "...";
var path = "...";
var url = "https://content.dropboxapi.com/2/files/download"+
          "?authorization="+encodeURIComponent("Bearer "+token)+
          "&arg="+encodeURIComponent(JSON.stringify({path:path}))
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!