<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getting rev from DBFILESMetadata in obj-c API 2 in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-rev-from-DBFILESMetadata-in-obj-c-API-2/m-p/191404#M8361</link>
    <description>&lt;P&gt;In your example, you would get it like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;self.dropboxFileRevision = ([result isKindOfClass:[DBFILESFileMetadata class]] ? [(DBFILESFileMetadata *)result rev] : nil);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DBFILESFileMetadata is a subclass of DBFILESMetadata. Basically (as I understand it), you’ll never receive a vanilla DBFILESMetadata object in a response, but will receive one of its subclasses - DBFILESFolderMetadata, DBFILESFileMetadata or DBFILESDeletedMetadata. So you need to check the class of the meta-data object to see what you can extract from it. (I wrote a category so that I can call -isDirectory, -isFile or -isDeleted on the meta-data object rather than have to write out -isKindOfClass: each time.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I’ve been getting to grips with the new API msyelf over the past few days, and the above comes from hounding Greg at Dropbox with questions. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt; )&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2016 15:45:05 GMT</pubDate>
    <dc:creator>Keith B.7</dc:creator>
    <dc:date>2016-10-20T15:45:05Z</dc:date>
    <item>
      <title>Getting rev from DBFILESMetadata in obj-c API 2</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-rev-from-DBFILESMetadata-in-obj-c-API-2/m-p/191399#M8359</link>
      <description>&lt;P&gt;Dear Dropbox,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for&amp;nbsp;the new obj-c API v2, looks like quite an effort! So far it's more convenient to use than API v1 and integration is going well. However, I'm a little held up on how to work with the response objects, I'm constantly looking for methods and properties on them that don't seem to be there and I think I'm misunderstanding how the union and struct object types work, the response and error objects.&amp;nbsp;Here's a small example: I'm checking that a file exists, and in API v1 I hung on to the `rev` of the file, so that after I download it and modify it, I want to push it back up, and I need the rev on upload to do that without creating a new file/conflict.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to this thread you can get the rev from the DBFILESMetadata response object in API 2:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropboxforum.com/t5/API-support/Using-file-revs-in-API-2/m-p/191299#M8348" target="_blank"&gt;https://www.dropboxforum.com/t5/API-support/Using-file-revs-in-API-2/m-p/191299#M8348&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;In API 2, DBFILESFileMetadata has an equivalent .rev property - so far, so good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I'm pretty baffled as to where/how, I don't see it any such property listed for that object in the&amp;nbsp;docs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESMetadata.html" target="_blank"&gt;https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESMetadata.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a simple request that I think helps lay out where I'm getting confused:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[[client.filesRoutes getMetadata:path] response:^(DBFILESMetadata * _Nullable result, DBFILESGetMetadataError * _Nullable routeError, DBError * _Nullable error) {
    if (result != nil) {
        // File exists at that path
        self.foundFile = YES;
        // save the file rev
        self.dropboxFileRevsion = ... ?
    } else {
        self.foundDatabaseFile = NO;
        // But how do I check DBFILESGetMetadataError correctly for this request
        // to see if it's file not found—or some other error? I can't tell from
        // docs just yet
        if (routError != nil) {
        	// the only property on routeError that seems to relate is path...
        }
    }
    [self doNextThing];
}];&lt;/PRE&gt;&lt;P&gt;Thanks for your time!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:29:07 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-rev-from-DBFILESMetadata-in-obj-c-API-2/m-p/191399#M8359</guid>
      <dc:creator>billymeltdown</dc:creator>
      <dc:date>2019-05-29T09:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rev from DBFILESMetadata in obj-c API 2</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-rev-from-DBFILESMetadata-in-obj-c-API-2/m-p/191404#M8361</link>
      <description>&lt;P&gt;In your example, you would get it like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;self.dropboxFileRevision = ([result isKindOfClass:[DBFILESFileMetadata class]] ? [(DBFILESFileMetadata *)result rev] : nil);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DBFILESFileMetadata is a subclass of DBFILESMetadata. Basically (as I understand it), you’ll never receive a vanilla DBFILESMetadata object in a response, but will receive one of its subclasses - DBFILESFolderMetadata, DBFILESFileMetadata or DBFILESDeletedMetadata. So you need to check the class of the meta-data object to see what you can extract from it. (I wrote a category so that I can call -isDirectory, -isFile or -isDeleted on the meta-data object rather than have to write out -isKindOfClass: each time.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I’ve been getting to grips with the new API msyelf over the past few days, and the above comes from hounding Greg at Dropbox with questions. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt; )&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 15:45:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-rev-from-DBFILESMetadata-in-obj-c-API-2/m-p/191404#M8361</guid>
      <dc:creator>Keith B.7</dc:creator>
      <dc:date>2016-10-20T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rev from DBFILESMetadata in obj-c API 2</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-rev-from-DBFILESMetadata-in-obj-c-API-2/m-p/191406#M8363</link>
      <description>&lt;P&gt;Ah, ha! Awesome, thanks Keith!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 16:02:36 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-rev-from-DBFILESMetadata-in-obj-c-API-2/m-p/191406#M8363</guid>
      <dc:creator>billymeltdown</dc:creator>
      <dc:date>2016-10-20T16:02:36Z</dc:date>
    </item>
  </channel>
</rss>

