有关直接链接的Dropbox API v1至v2 [英] Dropbox API v1 to v2 regarding direct link
问题描述
因此,我正在将Dropbox API从1.0端点切换到2.0端点并遇到问题。
So I am in the process of switching over the Dropbox API from 1.0 endpoints, to 2.0 endpoints and running into an issue.
我正在使用1.0端点< a href = https://api.dropboxapi.com/1/media/auto/ rel = nofollow noreferrer> https://api.dropboxapi.com/1/media/auto/
给了我一个很好的直接URL,例如:dropbox / blah / image.jpg
I was using the 1.0 endpoint https://api.dropboxapi.com/1/media/auto/ which gave me a nice direct URL for example: dropbox/blah/image.jpg
这使我可以直接存储图像(最多4个小时)而无需必须下载图像本身
This allowed me to store the image directly (for up to 4 hrs) without having to DOWNLOAD the image itself
现在在2.0版本中,我必须使用:
Now in 2.0 I have to use:
https://api.dropboxapi.com/2/files/get_temporary_link
这是一个主要问题,因为他们提供的链接已更改...它不再是直接的.jpg链接,而是经过编码的URL,例如
This is a major issue as the link they supply has changed...it's no longer a direct .jpg link, it's come encoded URL like
https://dl.dropboxuse rcontent.com/apitl/1/AAA-TFdndE32VU-ruMMtCUyDIIczr71Wp8u7XmVA
我无法在网络浏览器中直接点击它,但其中包含一些标头内容这是自动下载。...
which i can't hit directly in a web browser, it has some header content so it's an automatic download....
有人知道我如何在不自动下载的情况下直接链接到ACTUAL文件吗?我也不希望缩略图太小。
Does anyone know how I can get a direct link to the ACTUAL file without AUTO-DOWNLOADING? I Don't want the thumbnail either- that's too small.
推荐答案
使用v2 API,您可以使用这样的URL :
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"}
(正确编码URL参数)
(encode the URL parameters properly)
在Javascript中,将类似于以下内容:
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}))
这篇关于有关直接链接的Dropbox API v1至v2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!