DerivativesApi.getManifest方法或ManifestChildren.setRole方法似乎存在问题。
当我打电话给" $ apiInstance-> getManifest"时,我收到以下错误消息:
"调用DerivativesApi-> getManifest时出现异常:' role'的值无效,必须是' 2d',' 3d'中的一个, '图形','显示',' thumbnail'"
这是Stacktrace:
urn是正确的并且也正确编码,auth-token的范围是可查看的:read'。
我不知道在哪里搜索,我会感激任何帮助。
修改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();
}
答案 0 :(得分:2)
感谢您提供有用的提示,我找到了解决方案。
错误似乎是一个错误,因为ManifestChildren.role的新角色是在没有在模型中声明的情况下定义的。
PROPERTYDB - > Autodesk.CloudPlatform.PropertyDatabase(例如,这是一个缺少的'角色')
作为解决方法(对我有用)只需设置参数" accept_encoding" getManifest()到' gzip':
$result = $apiInstance->getManifest( $correctObject, 'gzip' );
现在一切正常。
查看here了解更多信息。