cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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

Greg-DB
Dropbox Staff

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.

David W.136
Helpful | Level 6

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

Greg-DB
Dropbox Staff

[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.

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/

 

Greg-DB
Dropbox Staff

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."

David W.136
Helpful | Level 6

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

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    David W.136 Helpful | Level 6
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Slava M. New member | Level 1
What do Dropbox user levels mean?