getManifest的问题(forge-php-client) [英] Issue with getManifest (forge-php-client)

查看:153
本文介绍了getManifest的问题(forge-php-client)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DerivativesApi.getManifest方法或ManifestChildren.setRole方法似乎存在问题.

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

当我调用"$ apiInstance-> getManifest"时,收到以下错误消息:

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

"调用DerivativesApi-> getManifest时的异常:'role'的值无效,必须为'2d','3d','graphics','manifest','thumbnail'中的一个"

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

这是Stacktrace:

Here's the Stacktrace:

该缸是正确的并且也已正确编码,auth令牌的范围为'viewables:read'.

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.

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

推荐答案

谢谢您的有用提示,我找到了一个解决方案.

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

该错误似乎是由于在模型中未声明beeing的情况下定义了ManifestChildren.role的新角色而发生的错误.

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(例如,这是一个丢失的角色")

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

作为解决方法(对我有用),只需将getManifest()的参数"accept_encoding"设置为"gzip":

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

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

现在一切正常.

此处中查找

这篇关于getManifest的问题(forge-php-client)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆