Forum Discussion

abhikarn's avatar
abhikarn
Explorer | Level 3
5 years ago
Solved

Authentication for File getContent - https://content.dropboxapi.com/2/cloud_docs/get_content

Hi,

While cosumning the api to get the file content ( https://content.dropboxapi.com/2/cloud_docs/get_content).

I am facing an error mentioned below:

 

Error in call to API function "cloud_docs/get_content": Invalid authorization value in HTTP header "Authorization": "Bearer <myApp access token>". Expecting "Bearer cd.<auth_token>". '// Here in myApp access token I have provide the app access token.

 

Am I passing the correct token?, as in the description of this service I saw one information "Please make a request to cloud_docs/authorize and supply that token in the Authorization header". But I did not find any information on that.

 

Please help in this regard.

 

 

  • Greg-DB's avatar
    Greg-DB
    5 years ago

    The /2/files/download endpoint is a "content-download" style endpoint, meaning it expects the parameters in the 'Dropbox-API-Arg' request header, not the request body. 

     

    You're sending your parameters in the request body, so it's returning that error. Move your parameter JSON to the 'Dropbox-API-Arg' request header instead.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    If you're trying to download file content, you should instead use /2/files/download, for normal files, or /2/files/export, for things that can't be downloaded normally. 

     

    Please refer to the documentation linked above for more information and examples.

    • abhikarn's avatar
      abhikarn
      Explorer | Level 3

      Hi Greg,

       

      I tried the api https://content.dropboxapi.com/2/files/download, but seeing an unsual error.

      Error in call to API function "files/download": The request body is supposed to be empty, but it isn't; got "{\x0D\x0A \"path\": \"/IssueTrackerV4.xlsx\"\x0D\x0A}".

       

      Not sure what is the issue. My request bod has below content:

      {
          "path""/IssueTrackerV4.xlsx"
      }
      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        The /2/files/download endpoint is a "content-download" style endpoint, meaning it expects the parameters in the 'Dropbox-API-Arg' request header, not the request body. 

         

        You're sending your parameters in the request body, so it's returning that error. Move your parameter JSON to the 'Dropbox-API-Arg' request header instead.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,941 PostsLatest Activity: 12 hours ago
351 Following

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 or Facebook.

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!