We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
anonymous
9 years agoBest way to get a file's URL
I am making an iOS app that displays all of the images from a selected folder. To make caching the images easier and more efficient I'm using the SDWebImage Library. SDWebImage requires a URL and I'm...
- 9 years agoThat is the right way to get a direct link to a file using the API.
I'll be happy to pass along as feedback or feature requests though. What specifically would be more useful? Thanks in advance!
Greg-DB
Dropbox Community Moderator
9 years agoThe error message is indicating that that's not a valid path value. The Dropbox path format doesn't necessarily match local filesystem path formats. For example, in this case, the path should be like "/NW Region Info Table Documents/0 Special Documents please read first file in this folder/DropboxForSeva.docx".
In general, you should just get the PathLower value from the Metadata objects returned by other API calls, such as listFolder.
In general, you should just get the PathLower value from the Metadata objects returned by other API calls, such as listFolder.
mikemalter
9 years agoHelpful | Level 5
Greg,
I'm trying to synch a desktop application UI with Dropbox and I started by getting a third party control that is a tree folder control. How sure are you that Dropbox's storage is not mirrored on my machine?
- Do you have a code sample for listFolder if all I have is a path from my computer? Do I have enough information on my end to get metadata from Dropbox for a particular item?
- Do you have a code sample for getting file metadata?
Thank you.
- Greg-DB9 years ago
Dropbox Community Moderator
If you use the official Dropbox desktop client, it will sync the contents of your Dropbox account to your local filesystem. Note that your local filesystem doesn't use the same path format as the remote Dropbox API though. For example, Dropbox API paths uses '/' as a separator, and not '\'.
1. The Dropbox API isn't really meant for use based on file paths originating from your local filesystem like this. It provides the entire file listing for your from the API itself. E.g., using listFolder as shown here:
https://github.com/dropbox/dropbox-sdk-dotnet/blob/9803a40b3169acf66a2d14e29af8750ebe6e3e17/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs#L267
(If you need to list the root Dropbox folder, using the empty string "" as the path.)
You can technically convert a local filesystem path, though I don't have sample code for that. For instance though, you can find the local Dropbox folder using this:
https://help.dropbox.com/desktop-web/locate-dropbox-folderThen, you can strip off the local folder root, and convert the path as necessary. (E.g., from '\" separators to "/".)
2. The listFolder method as above will return metadata, but you can also retrieve individual file metadata using GetMetadata as shown here:
https://github.com/dropbox/dropbox-sdk-dotnet/blob/9803a40b3169acf66a2d14e29af8750ebe6e3e17/dropbox-sdk-dotnet/Dropbox.Api.Tests/DropboxApiTests.cs#L91 - Pash2378 years agoNew member | Level 2
I have exactly the same question, but I'm writing native iOS application in ObjC.
I searched, but can't find a way to get the temporary link for a file. I found mysterious `DBFILESGetTemporaryLink` and `DBFILESGetTemporaryLinkArg`, but I don't know how to use them.
I just need an external URL for a file in Dropbox — don't want to download it to a temporary location or data in memory.
- Greg-DB8 years ago
Dropbox Community Moderator
Pash237 In the Dropbox API v2 Objective-C SDK, you would use the DBFILESUserAuthRoutes -getTemporaryLink: method:
That's an RPC-style method, so it would be used the same way as the createFolder example here:
https://github.com/dropbox/dropbox-sdk-obj-c#rpc-style-request
(I.e., `[[client.filesRoutes getTemporaryLink...`)
- Pash2378 years agoNew member | Level 2
Thanks, it works!
[[client.filesRoutes getTemporaryLink:path]
setResponseBlock:^(DBFILESGetTemporaryLinkResult *result, DBFILESGetTemporaryLinkError *routeError, DBRequestError *networkError) {
if (result) {
NSLog(@"Got URL for Dropbox file: %@", result.link);
}
}];
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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, Facebook or Instagram.
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!