Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Deepika G.1's avatar
Deepika G.1
New member | Level 1
9 years ago

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

Replies have been turned off for this discussion
  • Deepika G.1's avatar
    Deepika G.1
    New member | Level 1
    9 years ago

    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.'s avatar
    Steve M.
    Icon for Dropbox Staff rankDropbox Staff
    9 years ago

    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.'s avatar
    Steve M.
    Icon for Dropbox Staff rankDropbox Staff
    9 years ago

    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's avatar
    Deepika G.1
    New member | Level 1
    9 years ago

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

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    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.

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!