Take Your Search Game to the Next Level with Dropbox Dash  🚀✨ Curious how it works? Ask us here! 

Forum Discussion

sanathdevadiga's avatar
sanathdevadiga
Explorer | Level 3
3 years ago

How to upload file to dropbox using dropbox api

Hi all , i am integrating netsuite with dropbox to upload file from netsuite to dropbox . I have already done authentication and i am generating access token also .

Now i am not getting proper api to upload file into dropbox . Iam just uaing post method to call drop box api. Iam not importing any dropbox library's.

Can you please help me which api should i use and what all the parameters i hve to pass.
I have already checked filerequest/create but in this i dont know where i should add file content (img/pdf etc) .because no pareters are there for content i think .
Can you plese help me in this to achieve my task .

5 Replies

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    sanathdevadiga wrote:
    ... I have already done authentication and i am generating access token also .
    ...

    Hi sanathdevadiga,

    It's great you have realized the authentication already. Just a warning here. You've mentioned access token only, but nothing about refresh token! Take in mind that access token expire after some time (typical 4 hours). For long term access, you need refresh token and realizing refresh process. You can get some ideas here (if you haven't implemented it yet).

     


    sanathdevadiga wrote:
    ...
    I have already checked filerequest/create but in this i dont know where i should add file content (img/pdf etc) .because no pareters are there for content i think .
    ...

    File request is a way to give opportunity for somebody else to upload content, not to upload it by self! 😉

     


    sanathdevadiga wrote:
    ...
    Can you please help me which api should i use and what all the parameters i hve to pass.
    ...

    It's easy. The name can leads you: 2/files/upload. Just  mentioned call is suitable in many cases for no very huge files (no more than 150MB in size). If you have huge file or if you have big number of files (either small or big sized, or mixture), it may be mandatory (or better in some cases) usage of upload session and/or upload in batch. Review all calls listed after the simple upload call and select what best matches your needs. Of course, you can always start with just simple uploads and optimize your code after that. 😉

    Hope this helps.

  • sanathdevadiga's avatar
    sanathdevadiga
    Explorer | Level 3
    Hi , iam generatimg access token using refresh token only . Now file is getting uploading but when i open in dropbox it is showing currepted file its not opening. Can you help me in this . Can we add url link of file as argument ?.

    And one more thing how can i add destination for uploaded file in dropbox . In /upload api there is no destination parameter .


    Thank you for your response.
    • Здравко's avatar
      Здравко
      Legendary | Level 20

      sanathdevadiga wrote:
      Hi , iam generatimg access token using refresh token only . Now file is getting uploading but when i open in dropbox it is showing currepted file its not opening. Can you help me in this . ...

      Following your question at all, seems you are trying guess what you need to pass instead of read the documentation. In the documentation you can read type and formatting of all possible parameters, including mandatory parameter 'path' that describe 'place' where uploaded file will reside. Just read it. Can be useful to take a look on API Explorer for easier call prototyping. Finally the file content is passed as call body, not as a link or something like. If you want to pass file as a link take a look here.

      Good luck.

      • sanathdevadiga's avatar
        sanathdevadiga
        Explorer | Level 3
        Thank you for you valuable inputs .
        Now File is getting uploaded but its content is currupted , i tried base 64 encode , and utf-8 encode .My file is in UTF -8 encoded.

        May i know Which file format i have to send data to dropbox .

About Dropbox API Support & Feedback

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