Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to overwrite file with parent rev using Dropbox API in iOS?

I am developing an iOS application using Dropbox API. While uploading a file using the dropbox API, I just want to overwrite the existing file with the same name. How can I set the parent rev and what value? Thanks!

like image 879
vandana Avatar asked May 21 '12 09:05

vandana


2 Answers

Get all the files in the directory with [[self restclient] loadMetadata:@"/"]

in the delegate - (void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata you get all the details of each file. Scan through all the files with file name of your interest and get the rev details with file.rev and store it.

When you want to replace the file, for parentrev argument, give the nsstring as what you stored with file.rev

like image 134
sumanth Avatar answered Oct 18 '22 12:10

sumanth


https://www.dropbox.com/developers/reference/api#files_put

Refering to the Dropbox API you just have to specify the parent_rev parameter. If you don't know the parent_rev, just call the https://www.dropbox.com/developers/reference/api#metadata for the file. In the response of that call, you will find the parent_rev

like image 44
Lars Avatar answered Oct 18 '22 12:10

Lars