how long does I get urn in my code on derivativesApi
Autodesk.Forge.Model.DynamicJsonResponse translateResponse = derivativesApi.Translate(job, true); string responseUrn = translateResponse.Dictionary["urn"].ToString();
how long does I get urn in my code on derivativesApi
Autodesk.Forge.Model.DynamicJsonResponse translateResponse = derivativesApi.Translate(job, true); string responseUrn = translateResponse.Dictionary["urn"].ToString();
I guess you're asking the string length of the base64 urn.
It depends on the characters of the objectId
(a.k.a object urn returned by PUT /buckets/:bucketKey/objects/:objectName) you passed into the base64 string encoder with my experience, and it will be the same urn you pass to the POST job of the Forge Model Derivative API. Normally, each Base64 digit represents exactly 6 bits of data from the wiki and here is a formula to calculate the encoded string length link:
((4 * n / 3) + 3) & ~3
note1. n
is the string length of your objectId
.
For instance, the length of the urn:adsk.objects:os.object:mybucket/example.txt
is 47. After base64 encoding, the result dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvZXhhbXBsZS50eHQ=
length is ((4 * 47 / 3) + 3) & ~3 = 64
.
note2. The padding character =
must be removed while triggering Forge translation jobs manually, Forge Model Derivative API doesn't allow it. Here is the formula:
len of the urn = 64 - n of the padding character `=`
Therefore, the final string length of the urn you obtain from the API response is 64 - 1 = 63
.
Ref. https://en.wikipedia.org/wiki/Base64
note3. Unless you call DELETE :urn/manifest to deleted the translated results (a.k.a.viewable bubbles), viewable bubbles will be stored in Forge server permanently. You can also use viewable bubbles' urn to access them, despite the model file stored in your managed OSS bucket is deleted by the bucket policy you have set up.