We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Keith B.7
10 years agoHelpful | Level 7
Using file revs in API 2
In API 1, whenever a file was uploaded, a file rev was provided in the meta-data's .rev property in the "did upload" delegate methods. In API 2, DBFILESFileMetadata has an equivalent .rev property - so far, so good.
But how do I use that file rev when uploading files? In API 1, the -uploadFile:toPathwithParentRevfromUploadId: and -uploadFile:toPath:withParentRev:fromPath: methods allowed you to pass a cached file rev into them so that you could overwrite the file without having to delete it first.
In API 2, none of the -upload methods in DBFILESRoutes seem to allow you to pass in a file rev, so how is this done? Is it something to do with DBFILESWriteMode? (I couldn't see that had any way to pass in a file rev, either, though.)
Thanks!
4 Replies
- Keith B.710 years agoHelpful | Level 7
Hmm, actually, looking more at DBFILESWriteMode, is the rev what you are supposed to pass into -initWithUpdate:?
So, e.g.:
NSString *rev = ... // rev cached from a previous upload or listFolder: result. DBFILESWriteMode *update = [[DBFILESWriteMode alloc] initWithUpdate:rev]; DBUploadTask *uploadTask = [self.dropboxClient.filesRoutes uploadUrl:dropboxPath mode:update autorename:@NO clientModified:localModDate mute:@NO inputUrl:localFileURL];
Is this correct, or is the rev added a different way?
- Greg-DB10 years ago
Dropbox Community Moderator
That's correct. - Keith B.710 years agoHelpful | Level 7
Thanks. I think there's a minor documentation mistake in the DBFILESWriteMode.h file that is what makes this unclear. For -initWithUpdate:, it says this:
/// @param update Overwrite if the given "rev" matches the existing file's
/// "rev". The autorename strategy is to append the string "conflicted copy" to
/// the file name. For example, "document.txt" might become "document
/// (conflicted copy).txt" or "document (Panda's conflicted copy).txt".This is a duplicate of the paragraph above it which explains the purpose of the method. Presumably this paragraph should instead state that a file rev should be passed in as the update parameter. (Likewise in the documentation page on the site.) Because of this, I was looking elsewhere to find where I needed to input the "given 'rev'".
- Greg-DB10 years ago
Dropbox Community Moderator
I see, thanks for pointing that out!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!