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 do I retrieve a file's URL after searching for it using search API call

How do I retrieve a file's URL after searching for it using search API call

8ccarlile
Explorer | Level 3
Go to solution

Hi all,

I'm needing to 1) search Dropbox for all files containing a string, and then 2) get the URLs for all of the files found.

 

I've set up a Dropbox API call which searches Dropbox for files containing a certain string using 

https://api.dropboxapi.com/2/files/search_v2

So far so good, I'm getting a response with the correct files. However in this response, it lists everything about the files (name, path, last modified date/time etc) except for the URL. Is there any way to somehow extend the data presented in the API response? Or is there something else I need to add in to the request's body to return the URL (some kind of metadata call)?

Any help would be much appreciated!

 

1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20
Go to solution

@8ccarlile wrote:

... Is there any way to somehow extend the data presented in the API response? ...


Hi @8ccarlile,

Seems, my impression related to your final intent is wrong. The fastest way to get actual data of pointed file is using "2/files/download" API call. That's why I pointed this way. If for some reason you prefer web link, then you can get temporary one using "2/files/get_temporary_link" or create permanent using "2/sharing/create_shared_link_with_settings" API call. Already existing permanent link could be received using "2/sharing/list_shared_links" API call. Generally if you want to use file content within the application itself, better download it (one call less). If the content have to be forwarded to some other application, without granted access to the user account (client web browser, for example), then links are better. Temporary or permanent links - depends on what's your objectives. Permanent links let client optimise download speed (already cached content could be skipped) and fester work could be achieved. Temporary links are managed easily inside application and could be good compromise for incidental forwarding. Take in mind, permanent links when received are preview links! To get raw content link replace parameter "?dl=0" to "?raw=1". Once you have found what you're looking for using "2/files/search_v2" and "2/files/search/continue_v2", every metod, just described, gets usable. 😉

Hope this clarifies matter.

View solution in original post

4 Replies 4

Здравко
Legendary | Level 20
Go to solution

Hi @8ccarlile,

You have already everything need to reach file content, using the "2/files/download" API call. 😉

Hope this helps.

8ccarlile
Explorer | Level 3
Go to solution

Hi @

Здравко
Legendary | Level 20
Go to solution

@8ccarlile wrote:

... Is there any way to somehow extend the data presented in the API response? ...


Hi @8ccarlile,

Seems, my impression related to your final intent is wrong. The fastest way to get actual data of pointed file is using "2/files/download" API call. That's why I pointed this way. If for some reason you prefer web link, then you can get temporary one using "2/files/get_temporary_link" or create permanent using "2/sharing/create_shared_link_with_settings" API call. Already existing permanent link could be received using "2/sharing/list_shared_links" API call. Generally if you want to use file content within the application itself, better download it (one call less). If the content have to be forwarded to some other application, without granted access to the user account (client web browser, for example), then links are better. Temporary or permanent links - depends on what's your objectives. Permanent links let client optimise download speed (already cached content could be skipped) and fester work could be achieved. Temporary links are managed easily inside application and could be good compromise for incidental forwarding. Take in mind, permanent links when received are preview links! To get raw content link replace parameter "?dl=0" to "?raw=1". Once you have found what you're looking for using "2/files/search_v2" and "2/files/search/continue_v2", every metod, just described, gets usable. 😉

Hope this clarifies matter.

8ccarlile
Explorer | Level 3
Go to solution

Thanks very much for this , all makes sense!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    8ccarlile Explorer | Level 3
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?