You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

prrvchr's avatar
prrvchr
Explorer | Level 4
25 days ago

I can no longer upload files

Hi all,

 

For some time now I have not been able to upload my files via the HTTP API.

The file/upload or file/get_temporary_upload_link gives me a 404 error even though it worked perfectly until now.

 

If I do CURL tests then everything works perfectly, so I suspect an unsupported header. Here is the list of headers on my HTTP request (I use python/requests to do this):
 

 

Headers: {'User-Agent': 'python-requests/2.25.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/octet-stream', 'Dropbox-API-Arg': '{"mode":"overwrite","path":"/Sans nom 1.odt","autorename":false,"mute":false,"strict_conflict":false}', 'Content-Length': '473722', 'Authorization': 'Bearer sl.B_3Hk1dv...'}

 

 
I'll try adding these headers to CURL to see if that's where it comes from, but I'm interested in any good information.
 
Thanks.
  • prrvchr's avatar
    prrvchr
    Explorer | Level 4

    Ok the CURL header that seems to be no longer supported is:

     

     

    --header "Accept-Encoding: gzip, deflate" \

     

     

    How is this possible?

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

      I just gave this a try myself, but I'm not getting back a 404 error when I use that header. Can you share the full request and response for this issue so we can take a look? If you're using curl, use the -v option to enable verbose mode. Please redact your access token though. Thanks in advance!

      • prrvchr's avatar
        prrvchr
        Explorer | Level 4

        Hi Greg,

         

        No, it doesn't come from the headers, sorry.

        I can get this Curl query to work correctly:

         

        curl -X POST https://content.dropboxapi.com/2/files/upload \
            --header "Authorization: Bearer sl.B_2..." \
            --header "Dropbox-API-Arg: {\"autorename\":false,\"mode\":\"overwrite\",\"mute\":false,\"path\":\"/Test Dropbox.odt\",\"strict_conflict\":false}" \
            --header "User-Agent: python-requests/2.25.1" \
            --header "Accept-Encoding: gzip, deflate" \
            --header "Accept: */*" \
            --header "Connection: keep-alive" \
            --header "Content-Type: application/octet-stream" \
            --write-out "%{http_code}\n" \
            --data-binary "@/home/prrvchr/Test Dropbox.odt"

         

         

        On the other hand, if I use Python/Requests instead of Curl, it gives me a 404:

         

        import requests
        
        url = 'https://content.dropboxapi.com/2/files/upload'
        headers = {'Content-Type': 'application/octet-stream',
                   'Dropbox-API-Arg': '{"autorename": false, "mode": "overwrite", "mute": false, "path": "/Test Dropbox.odt", "strict_conflict": false}',
                   'Authorization': 'Bearer sl.B_2...'}
        data = open('/home/prrvchr/Test Dropbox.odt', 'rb')
        response = requests.put(url, headers=headers, data=data)
        print("Status Code: %s" % response.status_code)
        response.close()
        data.close()

         

         

        I don't see why...

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,883 PostsLatest Activity: 7 hours ago
326 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!