使用Dropbox API从Dropbox共享文件夹下载文件 [英] Download files from Dropbox shared folder using Dropbox API
问题描述
一个朋友给我发送了他与我共享的保管箱文件夹的URL。此文件夹中的文件总大小约为8GB。
A friend sent me the URL of a dropbox folder he shared with me. This folder has files whose total size is about 8GB.
我的基本帐户的上限为2GB,因此无法将共享文件夹的内容添加到我的保管箱文件夹中。
I have a basic account with 2GB limit, so I cannot add the shared folder contents to my dropbox folder.
如何以编程方式将所有文件从共享文件夹下载到PC?
How do I programmatically download all the files from the shared folder to my PC?
我检查了文档(两者v1和v2),并且没有找到可以做到这一点的API。我是否缺少某些东西?
I checked the documentation (both v1 and v2) and didn't find any APIs that would do this. Am I missing something?
推荐答案
Dropbox API的当前版本也具有用于获取共享链接的元数据的端点从共享链接下载文件的方式:
The current version of the Dropbox API, has endpoints for getting the metadata of shared links, as well as downloading files from shared links:
- 获取共享链接的元数据: / 2 / sharing / get_shared_link_metadata
- 从共享链接下载文件: / 2 / sharing / get_shared_link_file
- to get the metadata for a shared link: /2/sharing/get_shared_link_metadata
- to download files from a shared link: /2/sharing/get_shared_link_file
/ 2 / sharing / get_shared_link_metadata 端点很遗憾,它不会返回文件列表,因此,如果您需要以编程方式获取文件,与 / 2 / sharing / get_shared_link_file 一起使用的列表解决方法,您可以使用API v1端点 / 1 / metadata / link 。
The /2/sharing/get_shared_link_metadata endpoint unfortunately doesn't return the file listing though, so if you need to programmatically get the file listing for use with /2/sharing/get_shared_link_file, as a workaround you can use the API v1 endpoint /1/metadata/link.
编辑:
Dropbox API v2现在支持列出文件夹共享链接的内容。使用list_folder功能,可以使用与在已连接用户的帐户中列出文件夹相同的界面来完成此操作。要列出文件夹共享链接的内容,您可以在 shared_link
参数中为 / 2 / files / list_folder 。
Dropbox API v2 now supports listing the contents of a shared link for a folder. This can be accomplished using the same interface as listing a folder in a connected user's account, via the list_folder functionality. To list the contents of a shared link for a folder, you instead provide the shared link URL in the shared_link
parameter to /2/files/list_folder.
如果重新使用官方SDK,此端点也将有相应的方法。
If you're using an official SDK, there will also be a corresponding method for this endpoint.
这篇关于使用Dropbox API从Dropbox共享文件夹下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!