php – 未能使用亚马逊MWS Reports API获取财务交易报告
作者:互联网
我使用亚马逊API超过2年,我对它非常熟悉.我正在尝试使用Reports的API从亚马逊请求并订购此“_GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_”报告,并且它生成了ReportRequestID,但从未生成任何报告,我在过去3天内请求.
它的状态一直在提交,但从未更新为已完成状态.我也尝试过亚马逊ScratchPad.
我正在使用相同的报告API请求许多其他报告,它们完美无缺.
请告诉我是否有人遇到同样的问题.
这是我用来请求报告的代码:
$sdate = new DateTime('-7 days', new DateTimeZone('UTC'));
$startdate = $sdate->format("Y-m-d\T00:00:00P");
$edate = new DateTime('-1 days', new DateTimeZone('UTC'));
$enddate = $edate->format("Y-m-d\T23:59:59P");
$AWS_ACCESS_KEY_ID = $pos['azn_access_key'];
$AWS_SECRET_ACCESS_KEY = $pos['azn_secret_access_key'];
$APPLICATION_NAME = $pos['azn_app_name'];
$APPLICATION_VERSION = $pos['azn_app_version'];
$MERCHANT_ID = $pos['azn_merchant_id'];
$MARKETPLACE_ID = $pos['azn_marketplace_id'];
$MERCHANT_TOKEN = $pos['azn_merchant_token'];
$pos_name = $pos['nickname'];
$pos_id = $pos['id'];
$serviceURL = $pos['azn_service_url'];
$config = array(
'ServiceURL' => $serviceURL,
'ProxyHost' => null,
'ProxyPort' => -1,
'MaxErrorRetry' => 3,
);
$service = new MarketplaceWebService_Client(
$AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY, $config, $APPLICATION_NAME, $APPLICATION_VERSION);
$marketplaceIdArray = array("Id" => array($MARKETPLACE_ID));
//Sends Report Request
$parameters = array(
'Merchant' => $MERCHANT_ID,
'MarketplaceIdList' => $marketplaceIdArray,
'ReportType' => '_GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_',
'ReportOptions' => 'ShowSalesChannel=true',
'StartDate' => new DateTime($startdate, new DateTimeZone('UTC')),
'EndDate' => new DateTime($enddate, new DateTimeZone('UTC')),
);
$request = new MarketplaceWebService_Model_RequestReportRequest($parameters);
$request = new MarketplaceWebService_Model_RequestReportRequest();
$request->setMarketplaceIdList($marketplaceIdArray);
$request->setMerchant($MERCHANT_ID);
$request->setReportType('_GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_');
$request->setReportOptions('ShowSalesChannel=true');
$request->setStartDate(new DateTime($startdate, new DateTimeZone('UTC')));
$request->setEndDate(new DateTime($enddate, new DateTimeZone('UTC')));
$report_requestID = invokeRequestReport($service, $request);
解决方法:
无法通过API请求此报告.在请求报告时,< Scheduled>标签会告诉你它是否会被处理.对于GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_报告,您将始终获得< Scheduled> false< / Scheduled>.
另一种方法是使用用户界面安排报告,但这使您只能选择月度报告,而不是自定义日期范围报告.
标签:php,amazon-web-services,reporting-services,amazon-mws 来源: https://codeday.me/bug/20190628/1320093.html