cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to upload file to dropbox using dropbox api

How to upload file to dropbox using dropbox api

sanathdevadiga
Explorer | Level 3

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 5

Здравко
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
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.

Здравко
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
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 .

Здравко
Legendary | Level 20

Dropbox can support many different formarts and actually doesn't "support" anything. Tha data are transfered and store as just a bunch of bytes 😉 (i.e. whatever you are uploading, the same you will get). Most probably you have uploaded something different or not exactly the intended. Check it - try inspect what exactly you are uploading (on HTTP level) and see where is your error (befor or after that).

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    sanathdevadiga Explorer | Level 3
What do Dropbox user levels mean?