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): AutodeskForgeClientObjectSerializer::deserialize(Object(stdClass), '\Autodesk\Forge...', NULL)
2 *ObjectSerializer.php(291): AutodeskForgeClientObjectSerializer::deserialize(Array, '\Autodesk\Forge...', NULL)
3 *ObjectSerializer.php(236): AutodeskForgeClientObjectSerializer::deserialize(Object(stdClass), '\Autodesk\Forge...', NULL)
4 *ObjectSerializer.php(291): AutodeskForgeClientObjectSerializer::deserialize(Array, '\Autodesk\Forge...', NULL)
5 *DerivativesApi.php(403): AutodeskForgeClientObjectSerializer::deserialize(Object(stdClass), '\Autodesk\Forge...', Array)
6 *DerivativesApi.php(336): AutodeskForgeClientApiDerivativesApi->getManifestWithHttpInfo('dXJuOmFkc2sub2J...', NULL)
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 AutodeskForgeClientApiObjectsApi( $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 AutodeskForgeClientApiDerivativesApi( $twoLeggedAuth );
$jobInput = array(
'urn' => $correctObject
);
$jobPayloadInput = new AutodeskForgeClientModelJobPayloadInput( $jobInput );
$jobOutputItem = array(
'type' => 'svf',
'views' => array('3d', '2d')
);
$jobPayloadItem = new AutodeskForgeClientModelJobPayloadItem( $jobOutputItem );
$jobOutput = [
'formats' => array( $jobPayloadItem )
];
$jobPayloadOutput = new AutodeskForgeClientModelJobPayloadOutput( $jobOutput );
$job = new AutodeskForgeClientModelJobPayload();
$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 AutodeskForgeClientApiDerivativesApi( $twoLeggedAuth );
try {
$result = $apiInstance->getManifest( $correctObject, null );
$erg['translationstatus'] = 'Translation Status: ' . $result['status'];
$erg['translationprogress'] = "
Translation Progress: " . $result['progress'];
} catch( Exception $e ) {
$erg['failure'] = 'Exception when calling DerivativesApi->getManifest: ' . $e->getMessage();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…