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.

Discuss Dropbox Developer & API

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

How to transfer files from one dropbox account to another dropbox account programmatically?

How to transfer files from one dropbox account to another dropbox account programmatically?

gauravsc
Explorer | Level 3
Go to solution

I am lookingfor a way to transfer files from one account to another dropbox account. I would like to achieve this programmatically (.Net/ Javascript). I tried to look up in forum/stack overflow and drop box docs, but unable to find any relative explanation. I want to do it on dropbox side, like if there is any api call or something available which lets me to copy files, rather than downloading from one account and uploading again on another. If something is there, please help. I am starting to develop and kind of new here on this platform.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

It sounds like you're using two different apps; one for the source account, and one for the destination account. In order to use a copy reference between two accounts, they'll both need to be connected to the same app.

So, you should create an app on just one account, and then get an access token for that same app for each of the different accounts.

For the account that owns the app, you can do so easily by using the "Generate" button on the app's page on the App Console.

For the other account though, you'll need to use the OAuth app authorization flow:

https://www.dropbox.com/developers/reference/oauth-guide
https://www.dropbox.com/developers/documentation/http/documentation#authorization

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

Yes, Dropbox offers the ability to programmtically copy files between accounts without downloading and re-uploading them via the use of "copy references". You can find the documentation for it at the following links:

https://www.dropbox.com/developers/documentation/http/documentation#files-copy_reference-get

https://www.dropbox.com/developers/documentation/http/documentation#files-copy_reference-save

Those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible:

https://www.dropbox.com/developers/documentation

Those have corresponding native methods for the HTTPS endpoints. 

For example, in the .NET SDK:

https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_CopyRef...

https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_CopyRef...

And in the JavaScript SDK:

https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesCopyReferenceGet__anchor

https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesCopyReferenceSave__anchor

gauravsc
Explorer | Level 3
Go to solution

Hi Greg

Thank you very much for your reply. I have checked the documentation and it is very helpful. Now i am trying to simulate copy-paste as specified in above docs in postman. I am getting copy reference but when i try to save using the copy_reference-save, i get no permission error. What i am doing is:
1. Create app in source account, from which i need to copy the file.

2. Create access token from source account with full rights.

3. Repeat above steps for destination account.

4. Send post request to copy_reference-get with access token of source account. Here i get copy reference as response.

5. Send post request to copy_reference-save with access token of destination account. Here i get error as no_permission.

error -  no_permissionerror - no_permission

As i understand, my "destination account app" needs access of source account also. How can i connect "destination account app" to source account.

Greg-DB
Dropbox Staff
Go to solution

It sounds like you're using two different apps; one for the source account, and one for the destination account. In order to use a copy reference between two accounts, they'll both need to be connected to the same app.

So, you should create an app on just one account, and then get an access token for that same app for each of the different accounts.

For the account that owns the app, you can do so easily by using the "Generate" button on the app's page on the App Console.

For the other account though, you'll need to use the OAuth app authorization flow:

https://www.dropbox.com/developers/reference/oauth-guide
https://www.dropbox.com/developers/documentation/http/documentation#authorization

gauravsc
Explorer | Level 3
Go to solution

Hi greg, thanks for the reply.

I am able to replicate copy/paste from postman. If anyone is looking for quick test, here are the steps.

1. Create app in source account, from which i need to copy the file.

2. Create access token from source account with full rights.

3. Send post request to copy_reference-get with access token of source account. Here i get copy reference as response.

4. Open https://www.dropbox.com/oauth2/authorize?response_type=token&client_id=<YOUR_APP_KEY>&redirect_uri=<... redirect url or put any url here>

5. You will get prompt to login to dropbox, if not already logged in, and then you will be redirected to authorization page.

6. Once you click on allow, access token is generated and will be available from url returned. 

7. This access token can be used in postman for copy_reference-save.

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    gauravsc Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?