1

I am building a data tree (much like the viewer model tree), however I need to upload multiple files at a time (a mix of parts and assemblies). There are 2 times when I create this tree. The first is when my app loads, I loop thru all the objects in the bucket and call GetMetadataAsync to obtain the model guid and then call GetModelviewMetadataAsync to obtain the hierarchy which is then passed to the client side

The code for this is

        var oa = new OAuthController(_configuration);
        dynamic oauth = await oa.GetInternalAsync();
        DerivativesApi derivative = new DerivativesApi();
        derivative.Configuration.AccessToken = oauth.access_token;
        dynamic mDyn = await derivative.GetMetadataAsync(urn);
        string guid = "";
        foreach (KeyValuePair<string, dynamic> metadataItem in new DynamicDictionaryItems(mDyn.data.metadata))
        {
            guid = metadataItem.Value.guid;
        }

        dynamic hierarchy = await derivative.GetModelviewMetadataAsync(urn, guid);

When this is called for items existing in the bucket, all works as expected:

urn = dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dW1rcnozZzV4bm15ZmNyNTY3Z3FtcXFoa3ltczRpMnMtZGVidWczLTEyMzQ1LzNtbSUyMGZvbGRlZC5pcHQ=
guid = 0162f7fd-df63-4dc2-bb9b-dd7cb8b493c2
hierarchy = {"data":{"type":"objects","objects":[{"objectid":1,"objects":[{"objectid":2,"objects":[{"objectid":3,"name":"Solid1"}],"name":"3mm folded"}],"name":"3mm folded"}]}}

My problem occurs when I add a new file to the bucket and need to append to my data tree. Once loaded I call "TranslateAsync" and configure a webhook to notify me when the translation is complete. On the callback, I get the urn for the job, delete the webhook and then attempt to get the metatdata (all on the server side). This is the result I get for the same code and same part as above

urn = dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dW1rcnozZzV4bm15ZmNyNTY3Z3FtcXFoa3ltczRpMnMtZGVidWczLTEyMzQ1LzNtbSUyMGZvbGRlZC5pcHQ=
guid = f7156859-17f8-4a63-9c1c-4db53e4e97fa
hierarchy = {"result":"success"}

Notice the urn is the same, but the guid is different as is the result (hierarchy)

Could someone please help me understand what is going on here.

Many thanks

OldBloke
  • 51
  • 6

1 Answers1

0

First, you are not doing anything wrong :) the 202 response is one of the expected response you can get calling this endpoint as documented here.

As the properties database can be very large this endpoint usually returns a 202 HTTP code, to tell you that the server is loading the sqlLite database in memory. When you get the 202 response, it means you need to come back later and ask again.

Body example with Response 202

{
    "result": "success"
}

Once the database is loaded, it stays in memory for a certain time depending on the number of calls you are making on these endpoints, and then the server discards the database from memory (it will stay there at least few minutes).

It is important to know that you can use the forceget parameter on the first call to make sure to tell the server you want to load the database, even if it is very large. But use that parameter only once - it's rate limit is 60rpm versus thousands when not present (14000rpm). That way, you would save your forceget=true quota for other models to come.

cyrille
  • 2,616
  • 1
  • 10
  • 18
  • 1
    Thank you @cyrille. That has solved my issue. My mistake for using the .Net Core sdk documentation. I should always refer back to REST docs for those little gems. By the way, the .net api appears not to support the "forceget" option. Lesson learned – OldBloke Mar 18 '21 at 03:15
  • @OldBloke - really? this is bad :( I'll take a look and fix it - thx for letting me know. – cyrille Mar 18 '21 at 10:42