-1

It seems there is an issue with the DerivativesApi.getManifest method or with the ManifestChildren.setRole method.

When I call "$apiInstance->getManifest", I get the following error message:

"Exception when calling DerivativesApi->getManifest: Invalid value for 'role', must be one of '2d', '3d', 'graphics', 'manifest', 'thumbnail'"

Here's the Stacktrace:

1 *\ObjectSerializer.php(236): Autodesk\Forge\Client\ObjectSerializer::deserialize(Object(stdClass), '\\Autodesk\\Forge...', NULL)

2 *\ObjectSerializer.php(291): Autodesk\Forge\Client\ObjectSerializer::deserialize(Array, '\\Autodesk\\Forge...', NULL)\n

3 *\ObjectSerializer.php(236): Autodesk\Forge\Client\ObjectSerializer::deserialize(Object(stdClass), '\\Autodesk\\Forge...', NULL)

4 *\ObjectSerializer.php(291): Autodesk\Forge\Client\ObjectSerializer::deserialize(Array, '\\Autodesk\\Forge...', NULL)\n

5 *\DerivativesApi.php(403): Autodesk\Forge\Client\ObjectSerializer::deserialize(Object(stdClass), '\\Autodesk\\Forge...', Array)\n

6 *\DerivativesApi.php(336): Autodesk\Forge\Client\Api\DerivativesApi->getManifestWithHttpInfo('dXJuOmFkc2sub2J...', NULL)\n

The urn is correct and also correctly encoded, the scope of the auth-token is 'viewables:read'.

I don't know where to search, I'd appreciate any kind of help.

Edit 1:

$twoLeggedAuth->setScopes( [ 'data:read' ] );
$twoLeggedAuth->fetchToken();
$objApiInstance = new Autodesk\Forge\Client\Api\ObjectsApi( $twoLeggedAuth );
$correctObject = "";
$base64Urn = rtrim( strtr( base64_encode( $requestedURN ), '+/', '-_' ), '=' );
try{
    $bucketobjects = $objApiInstance->getObjects($bucket_key);
    foreach ($bucketobjects->getItems() as $key => $bucket_object){
        if($bucket_object->getObjectId() === $requestedURN){
            $correctObject = rtrim( strtr( base64_encode( $bucket_object->getObjectId() ), '+/', '-_' ), '=' );
        }
    }
}catch (Exception $e){
    $erg['failure'] = 'Exception when calling ObjectsApi->getObjects: ' . $e->getMessage();
}

$totranslate = true;
############ TRANSLATION-JOB
if($totranslate){
    $twoLeggedAuth->setScopes( [ 'data:read', 'data:write', 'data:create' ] );
    $twoLeggedAuth->fetchToken();
    $apiInstance = new Autodesk\Forge\Client\Api\DerivativesApi( $twoLeggedAuth );
    $jobInput = array(
        'urn' => $correctObject
    );
    $jobPayloadInput = new Autodesk\Forge\Client\Model\JobPayloadInput( $jobInput );
    $jobOutputItem = array(
        'type' => 'svf',
        'views' => array('3d', '2d')
    );
    $jobPayloadItem = new Autodesk\Forge\Client\Model\JobPayloadItem( $jobOutputItem );
    $jobOutput = [
        'formats' => array( $jobPayloadItem )
    ];
    $jobPayloadOutput = new Autodesk\Forge\Client\Model\JobPayloadOutput( $jobOutput );
    $job = new \Autodesk\Forge\Client\Model\JobPayload();
    $job->setInput( $jobPayloadInput );
    $job->setOutput( $jobPayloadOutput );
    $x_ads_force = true;
    try {
        $result = $apiInstance->translate( $job, $x_ads_force );
        $erg['success'] = 'Success! ';
    } catch( Exception $e ) {
        $erg['failure'] = 'Exception when calling DerivativesApi->translate: ' . $e->getMessage();
    }
}
$twoLeggedAuth->setScopes( [ 'data:read' ] );
$twoLeggedAuth->fetchToken();

$apiInstance = new Autodesk\Forge\Client\Api\DerivativesApi( $twoLeggedAuth );
try {
    $result = $apiInstance->getManifest( $correctObject, null );
    $erg['translationstatus'] = 'Translation Status: ' . $result['status'];
    $erg['translationprogress'] = "\t\nTranslation Progress: " . $result['progress'];
} catch( Exception $e ) {
    $erg['failure'] = 'Exception when calling DerivativesApi->getManifest: ' . $e->getMessage();
}
Community
  • 1
  • 1
PPlum
  • 21
  • 4
  • Show us the code being used to make the call. That error message sounds pretty clear. – ceejayoz Dec 22 '17 at 18:51
  • Hey @ceejayoz, it would be really cool if you have a look at my updated code. It would be even better if you knew whats going on here. – PPlum Dec 23 '17 at 18:42

1 Answers1

2

Thank you for your useful hints, I found a solution.

The error seems to be a bug that occurs because new roles for ManifestChildren.role were defined without beeing declared within the model.

PROPERTYDB -> Autodesk.CloudPlatform.PropertyDatabase (e.g. this is one missing 'role')

As workaround (that worked for me) just set the parameter "accept_encoding" of getManifest() to 'gzip':

$result = $apiInstance->getManifest( $correctObject, 'gzip' );

Everything works fine now.

Look here for further information.

PPlum
  • 21
  • 4