cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get the file path from a preview link?

How to get the file path from a preview link?

Tribecube T.
New member | Level 1

How can I get the proper Dropbox file path from a preview link obtained from the Dropbox Chooser? It is obviously unreliable to search for any file that matches the file name...

6 Replies 6

Re: How to get the file path from a preview link?

Greg-DB
Dropboxer

There currently isn't an officially supported way to get the original path from a shared link returned by the Chooser, but I'll be sure to pass this along as a request.

Re: How to get the file path from a preview link?

David W.136
Helpful | Level 5

Is there any way to get the path name of a file selected via the Chooser? That would be enormously helpful.

Re: How to get the file path from a preview link?

Greg-DB
Dropboxer

[Edit to clarify]

Actually, apologies, this doesn't get returned directly by the Chooser, but this is possible to get now depending on the link type setting you're using with the Chooser. That is, if you use the "preview" link type, you can then pass the link to /metadata/link to get the metadata, including path:

https://www.dropbox.com/developers-v1/core/docs#metadata-link

Note, that this call needs to be made using the correct user's auth in order to return the path information.

Re: How to get the file path from a preview link?

Slava M.
New member | Level 1

What does it mean "correct user's auth"?

/metadata/link description is unclear for me. It neither says about user auth nor links to related info.

 

[Updated] It seems that this link will help me: https://blogs.dropbox.com/developers/2015/08/new-api-endpoint-shared-link-metadata/

 

Re: How to get the file path from a preview link?

Greg-DB
Dropboxer

By "correct user's auth", I meant that in order to get the extra information such as "path", you need to make that API call using an access token for the user account that owns the link.

E.g., see the /metadata/link documentation for in_dropbox and path:

"in_dropbox: Returns true if the file or folder is in the authenticated user's Dropbox. If no access token is passed, then this will always return false.

path: Returns the path to the file or folder relative to the shared link's root. If the in_dropbox value is true and the shared link points to a file or folder within the authenticated user's Dropbox, it returns the same path that would be returned by the /metadata endpoint. If the request is made without an authenticated user or the shared link is not in the authenticated user's Dropbox, this will always return null."

Re: How to get the file path from a preview link?

David W.136
Helpful | Level 5

I hesitate to say this, because I am a terrible, terrible hobbyist programmer, but, I wrote up a tutorial on this. 

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    David W.136 Helpful | Level 5
  • User avatar
    Greg-DB Dropboxer
  • User avatar
    Slava M. New member | Level 1
What do Dropbox user levels mean?
Need more support?