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();
}