Download files from Dropbox shared folder using Dropbox API

夙愿已清 提交于 2019-12-10 11:26:55

问题


A friend sent me the URL of a dropbox folder he shared with me. This folder has files whose total size is about 8GB.

I have a basic account with 2GB limit, so I cannot add the shared folder contents to my dropbox folder.

How do I programmatically download all the files from the shared folder to my PC?

I checked the documentation (both v1 and v2) and didn't find any APIs that would do this. Am I missing something?


回答1:


The current version of the Dropbox API, has endpoints for getting the metadata of shared links, as well as downloading files from shared links:

  • 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

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.


Edit:

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.

If you're using an official SDK, there will also be a corresponding method for this endpoint.



来源:https://stackoverflow.com/questions/39749266/download-files-from-dropbox-shared-folder-using-dropbox-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!