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

Forum Discussion

Amit1's avatar
Amit1
New member | Level 1
11 years ago

OAuth get file request fails with file not found

I have been trying the OAuth api and wasn't able to get a file using the files get api as detailed here - https://www.dropbox.com/developers/core/docs#files-GET

My request looks as below
https://api-content.dropbox.com/1/files/auto/Images/thankyou.jpg
with the header - Authorization=Bearer <access-token>

I get a 404 error with the body as

{
    "error": "File not found"
}

Note that the account info api call succeeds. The files api call fails.
I have tried multiple forms of the get request but all of them give the same error
https://api-content.dropbox.com/1/files/auto/APIsForDummies.pdf
and https://api-content.dropbox.com/1/files/auto/Getting Started.pdf

How should the file path be given to make the api call succeed?

Thanks

6 Replies

  • Does your app have "Full Dropbox" or "App folder" permission?

    In the app folder case, the root of your paths refers to the app folder, so /files/auto/Images/thankyou.jpg will look for a file in /Dropbox/Apps/<your app name>/Images/thankyou.jpg.

    It might help if you make a metadata call so you can see what's actually in Dropbox first: https://api.dropbox.com/1/metadata/auto (with the Authorization header). The paths you see there should work when you call /files.

  • Amit1's avatar
    Amit1
    New member | Level 1
    11 years ago

    Great. You were spot on. I had placed the files under the root folder and not inside the app folder. It worked after I place my files under the App folder and try making the /files api call.

    I had initially tried the metadata api call but it seems that the documentation (https://www.dropbox.com/developers/core/docs#metadata) mentions that the api calls requires the path and I misinterpreted it. Not passing the path works is what didn't click me earlier.

    Thanks a ton!

  • InF B.'s avatar
    InF B.
    New member | Level 1
    9 years ago

    Have the same issue. I have "Full Dropbox" permission

    {"error": "File not found"}


    Under root I have "folder" folder and inside it left.png 

    Path is retrieved by metadata


    https://api-content.dropbox.com/1/files/auto/dropbox/folder/left.jpg?oauth_consumer_key=23ji9ydhhprk1tv&oauth_nonce=3b22dde5b2b300000&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1472210676&oauth_token=wy0vvhrabjdh714m&oauth_version=1.0&oauth_signature=nHJ0NC3c6EHocEQVKKJth%2FupO%2Bo%3D

    With App folder all works. But I need "Full Dropbox" permission

  • Steve M.'s avatar
    Steve M.
    Icon for Dropbox Staff rankDropbox Staff
    9 years ago

    InF B, /1/files/auto/dropbox/folder/left.jpg looks wrong. Based on your description of the location of the file, shouldn't that be /1/files/auto/folder/left.jpg (no "/dropbox")?

  • InF B.'s avatar
    InF B.
    New member | Level 1
    9 years ago

    Steve, without "/dropbox" I get 

    {"error": "Unauthorized"}
  • Steve M.'s avatar
    Steve M.
    Icon for Dropbox Staff rankDropbox Staff
    9 years ago

    Did you construct the right OAuth signature after changing the URL? (This error sounds like a bad OAuth signature.)

    Also, is there a reason you're using OAuth 1 and HMAC signatures? OAuth 1 with PLAINTEXT signatures is easier to work with, and OAuth 2 is even easier.

    Also, https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/, so you may just want to move to API v2 now (which only supports OAuth 2).

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!