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

iosenqa's avatar
iosenqa
Explorer | Level 4
6 years ago

Unable to upload the file via API

Unable to upload the files using API , see the Poster screenshot for paramaters and Body. Any help would be really appreciated.

Seeing below error : 

Error in call to API function "files/upload": Bad HTTP "Content-Type" header: "multipart/form-data; boundary=--------------------------098587943575938712484518". Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack".

 

Paramaters

 

 

  • The Dropbox API /upload endpoint does require that the HTTPS request use one of the Content-Type values listed in the error message you shared.

    I see that you are attempting to set a valid Content-Type value, but the actual request is using a different value ("multipart..."). It seems that the HTTPS client you're using is overriding the value you're attempting to set.

    You should refer to the documentation for the client you're using to determine how to disable that behavior. For instance, you likely will want to use the "binary" option seen in the screenshot of the "Body" tab you shared. 

    Also, note that some of your other headers look incorrect as well. The Dropbox API parameters should be sent as JSON in a single "Dropbox-API-Arg" header, not in separate "mode", "autorename", etc. headers like you have. You can find more information and an example in the documentation.

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

    The Dropbox API /upload endpoint does require that the HTTPS request use one of the Content-Type values listed in the error message you shared.

    I see that you are attempting to set a valid Content-Type value, but the actual request is using a different value ("multipart..."). It seems that the HTTPS client you're using is overriding the value you're attempting to set.

    You should refer to the documentation for the client you're using to determine how to disable that behavior. For instance, you likely will want to use the "binary" option seen in the screenshot of the "Body" tab you shared. 

    Also, note that some of your other headers look incorrect as well. The Dropbox API parameters should be sent as JSON in a single "Dropbox-API-Arg" header, not in separate "mode", "autorename", etc. headers like you have. You can find more information and an example in the documentation.

    • iosenqa's avatar
      iosenqa
      Explorer | Level 4

      after following the suggestions you mentioned, It works great. Now trying out retrieve features of the files.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,917 PostsLatest Activity: 5 hours ago
334 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!