cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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: 

Re: Unable to get preview url while while searching for files and folders

Could not get preview url while searching for preview urls

Sapu21
Explorer | Level 3

I am trying to search dropbox files inside my application. Although I am bale to find the folders and the files there is no way I can get the preview url of them so that I can redirect the user to the folder on dropbox. Is there any way to do that? In the documentation I have found that the preview url in search is an optional field.

1 Accepted Solution

Accepted Solutions

iNeil
Dropbox Engineer

@Sapu21 , the 'preview_url' is only available for shared items. It won’t be possible to retrieve a preview_url if the folder or file is not shared. Once you share the folder or file, the preview_url will be provided in the metadata within the response object.

A workaround for this case would be implementing the 2/sharing/create_shared_link_with_settings endpoint to create a shared link to your file or folder. If you use the settings parameter with the value 'audience: no_one', this will set the link so that it can't be used by anyone. The link will only direct the user to the content and will not grant additional rights to the user.

View solution in original post

5 Replies 5

Sapu21
Explorer | Level 3

I am trying to search for files and folders of dropbox using the search api . Although I am able to get the files and folders, there is no way I am getting the preview url of the files and the folders which are coming up in the results. I have read the documentation where the "preview_url" field is optional. Is this still in works? Is there a workaround on how we can get the preview url of the folders sepcifically if they are not shared?

iNeil
Dropbox Engineer

@Sapu21 , the 'preview_url' is only available for shared items. It won’t be possible to retrieve a preview_url if the folder or file is not shared. Once you share the folder or file, the preview_url will be provided in the metadata within the response object.

A workaround for this case would be implementing the 2/sharing/create_shared_link_with_settings endpoint to create a shared link to your file or folder. If you use the settings parameter with the value 'audience: no_one', this will set the link so that it can't be used by anyone. The link will only direct the user to the content and will not grant additional rights to the user.

Sapu21
Explorer | Level 3

Hey thanks a lot for the workaround..can this link which we are getting be used multiple times to view the file or the folder? Suppose if we store the link as a string in our db. Also can you please explain this part
 If you use the settings parameter with the value 'audience: no_one', this will set the link so that it can't be used by anyone. The link will only direct the user to the content and will not grant additional rights to the user.

Greg-DB
Dropbox Staff

Yes, these links can be used multiple times.

 

When using 'audience: no_one', the shared link itself does not grant any access. Someone who gets the link wouldn't be able to use it to access the file content unless they already have access to that file via their account anyway, such as if the file is in their account or in a shared folder they already have access to. That being the case, this kind of link is a good way of being able to link to the file but only for accounts that have access anyway.

Sapu21
Explorer | Level 3

Thanks a lot

 

Need more support?