Upload metadata link to Dropbox API

I have a very simple and quick question. I am using the Dropbox API API class written by Ben Tadiar. I am using $object->metaData("/"); to get a list of files from Dropbox. The data return does not contain a URL for downloading / previewing the file. Therefore, I have to call the $object->media() method for each file to get a URL that results in a delay amount , especially when the file list is too long.

In any case, to get a download link along with a file sheet ???

+4
source share
2 answers

Since I could not find a way to load the URL along with the list of files. The work around will be to list all the files without calling $object->media() for each element. Instead, call this method on the file that the user has selected to download. A simple quick function would be something like this:

 function getDBDownloadUrl($Path){ try{ $mdb = new MyDropbox(); $download = $mdb->media($Path); $download = $download['body']; return $download->url; } catch(Dropbox\Exception $e){ return array("error"=>1, "message"=>"There was a problem accessing file download URL from dropbox"); } } 
+2
source

When calling / metadata do you call it with "list" set to true? If so, can you get the path from the content array for the desired file and GET / files with this path? https://www.dropbox.com/developers/reference/api#metadata

0
source

Source: https://habr.com/ru/post/1436513/


All Articles