cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out 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: 

some questions about write mode

some questions about write mode

petal
Explorer | Level 4

Hi:

    It seems that dropbox handle files when there is a conflict like this: If one file in dropbox is being updated by multiple devices, some conflicting copies will be created, and users should merge these confilting files manully. Whether  I set write mode to add, overwrite or update has no influence about this. The conficting copy will be created anyway. 

    Now, I want to integrate dropbox into my own app by Java SDK for API v2. It seems the way dropbox app take a little inconvenient. So I wonder if there any other API for developers to handle this case?

    Another question is, how should I log out a dropbox account by API? And can I have a callback after successfully logging out to, for example, notify my own server?

    Thanks!

4 Replies 4

Re: some questions about write mode

Greg-DB
Dropboxer

When uploading files to Dropbox via the API, there are a number of different options you can use to control how overwriting, renaming, and conflicts work. For example, with the Java SDK, on the UploadBuilder class, refer to the documentation for UploadBuilder.withAutorenameUploadBuilder.withStrictConflict, and UploadBuilder.withMode. Also, be sure to read the documentation for WriteMode itself, as it has some more information on how the different write modes work. If something isn't working as documented, please share the steps and code to reproduce the issue so we can look into it.

 

Regarding logging out, there are actually a few different things this may refer to. I recommend reading this post for information on the different options. The Dropbox API doesn't offer a way to be notified when a user disconnects your app, but you can perform whatever calls you need from your app's own code of course.

Re: some questions about write mode

petal
Explorer | Level 4

Thanks, I have read the WriteMode link you give, and notice the description in the document.

The description about "ADD" is: Do not overwrite an existing file if there is a conflict. The autorename strategy is to append a number to the file name. For example, "document.txt" might become "document (2).txt".

And description about "OVERWRITE" is: Always overwrite the existing file. The autorename strategy is the same as it is for ADD.

But I still don't konw the difference between these two options. Since both option will create a new file like "document (2).txt", how should I understand the words "Always overwrite the existing file"? If I set write mode to overwrite, will every update from multiple devices be added to the end of "document.txt", and at the same time create "document (2).txt" for every update. And if in add mode, app will only create "document (2).txt", and don't add update to "document.txt" ? Did I understand in the right way? I don't have enough devices to try this, so I sincerely hope you can help me figure this out.

Thanks!

Re: some questions about write mode

Greg-DB
Dropboxer

If you use "overwrite", an existing file will be replaced by the new data. If you use "add", an existing file will not be replaced by the new data.

 

You don't actually need multiple devices to test this. You can just run multiple API calls from one place. I recommend using the API v2 Explorer to test this out. (You can even open it in multiple windows/tabs if you want.)

Re: some questions about write mode

petal
Explorer | Level 4

Thanks a lot. I will try

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    petal Explorer | Level 4
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?