cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: I want to implement a funtionallity that user can login to their dropbox account by my web application and i want to show all folder of dropbox on my web application screen . How can i do this .

I want to implement a funtionallity that user can login to their dropbox account by my web application and i want to show all folder of dropbox on my web application screen . How can i do this .

Deepika G.1
New member | Level 1

I want to implement a functionality that user can login to their dropbox account by my web application and i want to show  all folder of  dropbox on my web application screen . How can i do this .

15 Replies 15

Steve M.
Dropbox Staff

What do you mean by "it returns nothing"?

This part looks wrong:

'Content-Type: ', 'Authorization: Bearer ' . $key

But in general, the API returns pretty clear error messages that tell you what is wrong with a request, so make sure you're able to read the HTTP response bodies even when an error occurs.

Deepika G.1
New member | Level 1

Now am using

CURLOPT_HTTPHEADER => array( 'Authorization: Bearer ' . $key, 'Dropbox-API-Arg:' . $data),

but it giving me below error.

Error in call to API function "files/download": You provided a non-empty HTTP "Content-Type" header ("application/x-www-form-urlencoded"). This API function requires that the header be missing or empty.

 

Can you please tell me what parameter should i pass to get response

Steve M.
Dropbox Staff

Sorry, I think I steered you wrong. Your Content-Type header was fine... here's code that's working for me:

$accessToken = '<REDACTED>';

$ch = curl_init();
$data = json_encode(array('path' => '/test.txt'));
curl_setopt_array($ch, array(
CURLOPT_URL => 'https://content.dropboxapi.com/2/files/download',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => array("Content-Type:", "Authorization: Bearer $accessToken", "Dropbox-API-Arg: $data"),
));
$output = curl_exec($ch);
curl_close($ch);
echo $output;

 

Steve M.
Dropbox Staff

An alternative (drop both CURLOPT_POST and the Content-Type header):

curl_setopt_array($ch, array(
CURLOPT_URL => 'https://content.dropboxapi.com/2/files/download',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array("Authorization: Bearer $accessToken", "Dropbox-API-Arg: $data"),
));

Deepika G.1
New member | Level 1

Now am using above code. Error is removed now but its not returning any response.

Greg-DB
Dropbox Staff

If you're not getting an error, the response should be the file content. Is it possible the file is 0 bytes? You can check on the Dropbox web site.

Need more support?