I have an URL for a folder with files that I need to download using the API. Although the folder is public, and I'm able to download files from it on the website without any kind of authorizaiton or credentials, I'm not sure how appropriate it is to post it in a public forum. As an example that's similar, and gets me the same results, I'll use this URL:
https://www.dropbox.com/sh/p0fa8tl8zzmetuv/AABKUyvlxZGIOvxPWPoothbra?dl=0
for the folder, and this one:
https://www.dropbox.com/sh/p0fa8tl8zzmetuv/AABKUyvlxZGIOvxPWPoothbra/bar/baz.txt?dl=0
for a file.
(I found the example in this post:
https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/API-method-to-download-file-within-shared-folder-no-token/m-p/427727
Hopefully, the author of that post won't mind my using it here.)
With the Java SDK, if I try to use client.sharing().getSharedLinkMetadata(fileUrl) on the folder URL it works, but on the file URL I get SHARED_LINK_ACCESS_DENIED. I guess the file URL isn't technically a shared link, but it's in a shared folder, so there should be some way to get it. If I try to download the file with client.files().download(path) using the folder ID from the metadata in the path (id:kLMXpr_BUfIAAAAAAAQJqg/bar/baz.txt), I get not_found. If I construct the path from the URL (/sh/p0fa8tl8zzmetuv/AABKUyvlxZGIOvxPWPoothbra/bar/baz.txt) I also get not_found. I tried mounting the folder using client.sharing().mountFolder(folderId), but that got invalid_id.
I must be missing something. Any suggestions?
Also, why do my access tokens keep expiring? I thought they were supposed to be more or less permanent.