<?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: Problem with GetMetadataAsync in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341252#M19752</link>
    <description>&lt;P&gt;My apologies. I disovered I'd forgotten to await the delay, so it wasn't actually waiting for it. Oops! Now that I've rectified that, the code is working correctly... sometimes. I originally had a 500ms wait between each item (since Bing image search limited to 3 per second), and I still get issues at that speed (500ms later, a Dropbox folder which has been created is still being reported as not existing yet), but I decided to try having a 350ms delay between each image, and the code is working correctly at that slower speed (though otherwise that is un-necessarily slow, since I should only need to wait for each item, not each image). Also got rid of most, but not all, of the retry exceptions at the slower speed. You said there was a generous API call limit - what is it? (I've not seen it mentioned) I can try pacing my code to that and see how it goes. So, there's still an issue, but I have a work-around for the time being.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Apr 2019 08:34:55 GMT</pubDate>
    <dc:creator>donaldp</dc:creator>
    <dc:date>2019-04-25T08:34:55Z</dc:date>
    <item>
      <title>Problem with GetMetadataAsync</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341045#M19747</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to test for the existence of a folder so as not to repeat myself. My understanding is that you use&amp;nbsp;GetMetadataAsync and treat the folder as not there if you get an exception. (1) I'm getting exceptions at times that I shouldn't - i.e. there IS a folder there - and (2) I'm also having trouble getting further info from the exception. This is in C#/.NET in VS2017 on Win10.&lt;/P&gt;&lt;P&gt;What I've found is when I set a beakpoint and step through the code, it works perfectly! But when I remove the breakpoint I sometimes get exceptions when I shouldn't (so apparently some kind of timing issue). The relevant code is (note Dataservice is a Dropbox instance, accessed through an Interface)...&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;public async Task&amp;lt;Metadata&amp;gt; GetFolderMetadata(string path)
{
if (DropboxDebug) { log.SMAdebug("GetFolderMetadata has started");};
using (DropboxClient DxClient=new DropboxClient(AccessToken)){
    try {
        Metadata metadata =await DxClient.Files.GetMetadataAsync(path);
        if (DropboxDebug) { log.SMAdebug("GetFolderMetadata has ended normally");};
        return metadata;
        }
    catch {
        if (DropboxDebug) {log.SMAdebug("Exception in GetFolderMetadata");};
        return null;
        }
    }
}&lt;/PRE&gt;&lt;PRE&gt;    var folderMetadata=await DataService.GetFolderMetadata(thisFolder);
    if (folderMetadata!=null) {
        if (VMdebug) {
            System.Diagnostics.Debug.WriteLine(string.Format("{0} already exists - skipping",thisFolder));
            };
        continue;
    } else {
        if (VMdebug) {log.SMAdebug("Creating folder",thisFolder);};
        await DataService.CreateFolder(thisFolder,false);
        };
 &lt;/PRE&gt;&lt;P&gt;I did try to get further info from the exception by putting "catch (ApiException e) {...", but it wanted further info, and since I was getting "ApiException'1", I tried "catch (Apiexception&amp;lt;1&amp;gt;) {...", but VS didn't like that either. Not sure what syntax I need to put to get further info from this exception (which, as noted, being returned when it shouldn't when no breakpoints).&lt;/P&gt;&lt;P&gt;Not sure if there's an intentional limit to how often you can query the API, or if I'm just running into a glitch? i.e. not sure if I need to be dealing with it (presumably by sticking in a delay, though note I still would like to know how to get further info from the exception to confirm what it's complaining about), or if maybe there's something you need to look at on your end.&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Donald.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:06:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341045#M19747</guid>
      <dc:creator>donaldp</dc:creator>
      <dc:date>2019-05-29T09:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GetMetadataAsync</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341113#M19750</link>
      <description>&lt;P&gt;Hi Donald, there is a rate limiting system on the&amp;nbsp;Dropbox API, but it's relatively generous. If you are hitting it though, the&amp;nbsp;Dropbox API will return an explicit rate limiting error. It's possible you're missing that since you're not inspecting what kind of exception you're getting, as you mentioned. Likewise, there are &lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Files_LookupError.htm" target="_self"&gt;other exceptions&lt;/A&gt; that can occur on&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_GetMetadataAsync_1.htm" target="_self"&gt;GetMetadataAsync&lt;/A&gt; other than just 'not_found'.&lt;/P&gt;
&lt;P&gt;Here's an example of how you can break out some of the various error cases:&lt;/P&gt;
&lt;PRE&gt;try
{
    Metadata res = await client.Files.GetMetadataAsync(path);
    Console.WriteLine("{0}", res);
}
catch (ApiException&amp;lt;GetMetadataError&amp;gt; e)
{
    if (e.ErrorResponse.IsPath) {
        if (e.ErrorResponse.AsPath.Value.IsNotFound) {
            Console.WriteLine("Path not found!");
        } else if (e.ErrorResponse.AsPath.Value.IsMalformedPath) {
            Console.WriteLine("Malformed path!");
        } // and so on for the other .Is* methods as desired
        else {
            Console.WriteLine("LookupError: {0}", e.ErrorResponse.AsPath.Value);
        }
    } else {
        Console.WriteLine("GetMetadataError: {0}", e);
    }
} catch (Exception e)
{
    Console.WriteLine("Some other error: {0}", e);
}&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Apr 2019 15:20:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341113#M19750</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-04-24T15:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GetMetadataAsync</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341195#M19751</link>
      <description>&lt;P&gt;Hi Greg,&lt;/P&gt;&lt;PRE&gt;catch (ApiException&amp;lt;GetMetadataError&amp;gt; e)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks for that! That was the missing piece of the puzzle. I can confirm now that I'm getting "path/not_found/..." for a folder that has definitely already been created (FYI I'm dealing with input that has duplicates, and editing them out is not practical, so I'm just looking to skip processing the duplicates. i.e. test if that folder has already been created).&lt;/P&gt;&lt;P&gt;I'm also getting a lot of "Exception thrown: 'Dropbox.Api.RetryException' in Dropbox.Api.dll" messages, though it's not crashing the program, and also not being caught by my general catch statement for this line of code (perhaps because it's coming from somewhere in Dropbox.Api?). Note: I already had a 500ms delay due to part of the process being a Bing image search - which is limited to 3 per second - however I doubled it to 1000, and STILL getting this "not found" and retry exceptions for a folder that was already created 1000ms previously. 2000ms, same thing. 5000ms, same thing. Becoming ridiculous now. As noted, works perfectly with breakpoints, just not working at normal speed. Not sure how to fix this?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 22:35:35 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341195#M19751</guid>
      <dc:creator>donaldp</dc:creator>
      <dc:date>2019-04-24T22:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GetMetadataAsync</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341252#M19752</link>
      <description>&lt;P&gt;My apologies. I disovered I'd forgotten to await the delay, so it wasn't actually waiting for it. Oops! Now that I've rectified that, the code is working correctly... sometimes. I originally had a 500ms wait between each item (since Bing image search limited to 3 per second), and I still get issues at that speed (500ms later, a Dropbox folder which has been created is still being reported as not existing yet), but I decided to try having a 350ms delay between each image, and the code is working correctly at that slower speed (though otherwise that is un-necessarily slow, since I should only need to wait for each item, not each image). Also got rid of most, but not all, of the retry exceptions at the slower speed. You said there was a generous API call limit - what is it? (I've not seen it mentioned) I can try pacing my code to that and see how it goes. So, there's still an issue, but I have a work-around for the time being.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 08:34:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341252#M19752</guid>
      <dc:creator>donaldp</dc:creator>
      <dc:date>2019-04-25T08:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GetMetadataAsync</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341326#M19754</link>
      <description>&lt;P&gt;Thanks for following up. You shouldn't be getting '&lt;SPAN&gt;not_found' for a path that already exists, but if you are calling to get the metadata immediately after the item is created (e.g., in the case of a duplicate in your input list), there is a chance that can happen. The&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_CreateFolderV2Async_1.htm" target="_self"&gt;CreateFolderV2Async&lt;/A&gt; method (as well as others, such as the upload methods) return the metadata for the new item, so I&amp;nbsp;recommend keeping track of those results and de-duplicating locally, as that would likely be faster and less error-prone in this scenario.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Alternatively, you can just allow&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_CreateFolderV2Async_1.htm" target="_self"&gt;CreateFolderV2Async&lt;/A&gt;&amp;nbsp;(assuming that's what you're using) to run whenever&amp;nbsp;you are getting 'not_found', and catch the &lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Files_CreateFolderError.htm" target="_self"&gt;CreateFolderError&lt;/A&gt; on that. I.e., to ignore it if it contains a&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Files_WriteConflictError_Folder.htm" target="_self"&gt;WriteConflictError.Folder&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Anyway, a&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_RetryException.htm" target="_self"&gt;RetryException&lt;/A&gt; isn't actually explicit rate limiting. (That would be&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_RateLimitException.htm" target="_self"&gt;RateLimitException&lt;/A&gt;.) That just indicates an issue on the&amp;nbsp;Dropbox servers so you can have your app retry the request if you wish.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 16:01:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341326#M19754</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-04-25T16:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GetMetadataAsync</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341434#M19759</link>
      <description>&lt;P&gt;&lt;SPAN&gt;"Alternatively, you can just allow&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_CreateFolderV2Async_1.htm" target="_self" rel="nofollow noopener noreferrer"&gt;CreateFolderV2Async&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;(assuming that's what you're using) to run whenever&amp;nbsp;you are getting 'not_found', and catch the&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Files_CreateFolderError.htm" target="_self" rel="nofollow noopener noreferrer"&gt;CreateFolderError&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;on that. I.e., to ignore it if it contains a&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Files_WriteConflictError_Folder.htm" target="_self" rel="nofollow noopener noreferrer"&gt;WriteConflictError.Folder"&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I think that's the best solution. Thanks for the suggestion!&lt;/P&gt;&lt;P&gt;In the meantime, working on implementing that, I'm now hitting the ratelimit exceptions, so can you please let me know what the allowed rate is so that I can pace my code appropriately? Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 08:29:04 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341434#M19759</guid>
      <dc:creator>donaldp</dc:creator>
      <dc:date>2019-04-26T08:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GetMetadataAsync</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341490#M19761</link>
      <description>&lt;P&gt;We don't document any specific numbers for the rate limit. Apps should be written to dynamically catch and handle any rate limiting errors instead of hard coding limits. You should use the returned&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/P_Dropbox_Api_Auth_RateLimitError_RetryAfter.htm" target="_self"&gt;RateLimitError.RetryAfter&lt;/A&gt; value to see how long to wait before retrying.&lt;/P&gt;
&lt;P&gt;Also, note that not all&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_RateLimitException.htm" target="_self" rel="nofollow noopener noreferrer"&gt;RateLimitException&lt;/A&gt;&amp;nbsp;indicate explicit rate limiting exactly. You should check the&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Auth_RateLimitReason.htm" target="_self"&gt;RateLimitReason&lt;/A&gt;&amp;nbsp;in&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/P_Dropbox_Api_Auth_RateLimitError_Reason.htm" target="_self"&gt;RateLimitError.Reason&lt;/A&gt; to see why the request couldn't be serviced at that time.&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Auth_RateLimitReason_TooManyRequests.htm" target="_self"&gt;RateLimitReason.TooManyRequests&lt;/A&gt; indicates explicit rate limiting, but&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Auth_RateLimitReason_TooManyWriteOperations.htm" target="_self"&gt;RateLimitReason.TooManyWriteOperations&lt;/A&gt; just indicates "lock contention". You can read more about lock contention in &lt;A href="https://www.dropbox.com/developers/reference/data-ingress-guide" target="_self"&gt;the Data Ingress guide&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 15:02:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-with-GetMetadataAsync/m-p/341490#M19761</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-04-26T15:02:33Z</dc:date>
    </item>
  </channel>
</rss>

