You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Vincent P.9
9 years agoExplorer | Level 4
How to read a shared folder link in v2?
When I share a dropbox folder by passing a link to someone, the format is something like:
https://www.dropbox.com/sh/someid/someotherid?dl=0
Here is the API to read a shared folder:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_folder_metadata
What is the folder id? I tried every part of the shared link without any success, I just get a 409 error "Invalid id".
How can I read a shared link?
- Alexander P.5New member | Level 1
Crying here.
- Greg-DBDropbox Staff
The /2/sharing/get_folder_metadata endpoint you're referring to is for operating on shared folders, but you have a shared link (to a folder) which is a different kind of sharing functionality on Dropbox and so uses a different ID.
If you want information about a shared link, for a file or folder, you can use /2/sharing/get_shared_link_metadata:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata
Or to download file content from a link:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file
- timExplorer | Level 4
@Gregory, how can you list the files that are at the public shared link?
get_shared_link_metadata does not return the list of files, and does not return the shared folder ID, so how is this possible?
- timExplorer | Level 4
... forgot to write: this must be possible because it is possible in API v1 with
https://api.dropbox.com/1/metadata/link
... i'm using SwiftyDropbox v2 and not able to do this now
- Greg-DBDropbox StaffDropbox 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 list_folder:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
If you're using an official SDK, there will also be a corresponding method for this endpoint:
In the .NET SDK that's available as `ListFolderAsync`:
https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_ListFolderAsync_1.htm
In the Java SDK that's available via `listFolderBuilder` to get a `ListFolderBuilder` on which you can call `ListFolderBuilder.withSharedLink`:
https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolderBuilder-java.lang.String-
https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/ListFolderBuilder.html
https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/ListFolderBuilder.html#withSharedLink-com.dropbox.core.v2.files.SharedLink-
In the JavaScript SDK that's available as `filesListFolder`:
https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolder__anchor
In the Python SDK that's available as `files_list_folder`:
https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.dropbox.Dropbox.files_list_folder
In the Swift SDK that's available as `listFolder`:
https://dropbox.github.io/SwiftyDropbox/api-docs/latest/Classes/FilesRoutes.html#/s:13SwiftyDropbox11FilesRoutesC10listFolderAA10RpcRequestCyAA0C0C04ListF16ResultSerializerCAH0if5ErrorK0CGSS4path_Sb9recursiveSb16includeMediaInfoSb0O7DeletedSb0O24HasExplicitSharedMembersSb0O14MountedFolderss6UInt32VSg5limittF
In the Objective-C SDK that's available as `listFolder`:
https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESUserAuthRoutes.html#/c:objc(cs)DBFILESUserAuthRoutes(im)listFolder:
- Greg-DBDropbox Staff
Hi Tim, unfortunately that endpoint in API v2 doesn't currently return those particular pieces of information, but I'll be sure to pass this along as a feature request.
- gilbertwulffExplorer | Level 3
Hey, is there an update on this already? I'm trying to get the shared folder id using the GetSharedLinkMetadataAsync method and its returning a way different id (ie: id:3loy3mKeW5AAAAAAAAAACw) compared to the one expected in the MountFolderAsync method.
Is there a way i can get the right folder id using an api from a shared folder link?
- Greg-DBDropbox Staff
gilbertwulff You opened a new thread for your question so I'll follow up there:
https://www.dropboxforum.com/t5/API-support/Why-are-the-ids-different/m-p/241094#M13418
- timExplorer | Level 4
Wait so in v2 there is no way to list the files in a shared folder?! Ugggh i have to revert my whole app to v1?!
- Greg-DBDropbox Staff
Apologies for the inconvenience! The API v2 shared link endpoint doesn't return all of the same information. I've sent this along as a request but I can't offer a timeline for when it may be added to v2.
- carp21Helpful | Level 6
Thank you Greg!
- timExplorer | Level 4
Yeah, "the same information" isn't what's necessary. "Doing the most basic thing that it did in v1", ie. listing files, is necessary.
- Alexander P.5New member | Level 1
Vincent, could you please share a bit in V1 how you use that list that v1 https://api.dropbox.com/1/metadata/link gives?
I'm after links to actual files, not just their names.
Can't figure that out from docs so far :(
- Greg-DBDropbox Staff
Alexander, it sounds like you already sorted some of this out, so I'll follow up on the latest thread you replied on, so as not to spam others on these threads.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 2 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!