我使用AdobeDigitalMarketing API(https://github.com/Adobe-Marketing-Cloud/marketing-cloud-php-sdk)进行API调用以获取Omniture数据。
此脚本正常工作:
define('OMNITURE_USERNAME', 'XXX');
define('OMNITURE_SECRET', 'XXX');
define('ROOT', dirname(__FILE__));
require_once(ROOT.'/lib/AdobeDigitalMarketing/Autoloader.php');
AdobeDigitalMarketing_Autoloader::register();
$adm = new AdobeDigitalMarketing_Client();
$adm->authenticate(OMNITURE_USERNAME, OMNITURE_SECRET);
echo $adm->getCompanyApi()->getEndpoint('Ford EU');
$reportApi = $adm->getReportApi();
$response = $reportApi->queueRanked(array(
'reportSuiteID' => 'fmeuesprod',
'date' => date('Y-m-d', strtotime("-1 day")),
'metrics' => array(
array('id' => 'instances'),
),
'elements' => array(
array('id' => 'prop11'),
),
'segments' => array(
array('id' => 'prop11', 'selected' => array('brand:vehicle:brochures:interactive'))
),
'segment_id' => 'dw:80632'
));
$reportId = $response['reportID'];
//echo $reportId;
//$reportId = '67854594';
do {
$report = $reportApi->getReport($reportId);
sleep(2);
} while ($report['status'] == 'not ready');
print_r($report['report']);
但如果我打电话过几次,那就回复一下:
Fatal error: Uncaught exception 'AdobeDigitalMarketing_Api_ReportError' with message 'A system error has occurred' in /var/www/OmnitureAPI/lib/AdobeDigitalMarketing/Api/Report.php:202 Stack trace: #0 /var/www/OmnitureAPI/lib/AdobeDigitalMarketing/Api/Report.php(84): AdobeDigitalMarketing_Api_Report->returnResponse(Array) #1 /var/www/OmnitureAPI/test.php(43): AdobeDigitalMarketing_Api_Report->getReport(67856255) #2 {main} thrown in /var/www/OmnitureAPI/lib/AdobeDigitalMarketing/Api/Report.php on line 202
如果我等待大约5分钟,然后按F5,则脚本可以正常工作,如果再次按F5,则返回错误... API的文档没有显示这个问题,我需要每次都用不同的日期来调用这个脚本。
有什么想法解决这个问题吗?
谢谢!
答案 0 :(得分:0)
我发现了问题:
API 1.3现在已“过时”,如果在登录前更改API,则全部工作:
$adm = new AdobeDigitalMarketing_Client();
$adm->getHttpClient()->setOption('api_version', '1.4');
$adm->authenticate(OMNITURE_USERNAME, OMNITURE_SECRET);
感谢大家的帮助和评论!