【问题标题】:How do I set report type for Amazon MWS report api如何设置亚马逊 MWS 报告 API 的报告类型
【发布时间】:2014-11-14 11:26:03
【问题描述】:

我已从亚马逊卖家中心订购此交易报告,因为无法从报告的 API 请求。 现在我正在尝试使用运行良好的报告 api 下载此报告,但现在我正在尝试将报告类型设置为“_GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_”,以便仅获得此类报告的请求报告列表。 我正在使用下面的代码,但它给了我这个错误

"致命错误:在非对象上调用成员函数 getType() /AmazonAPI/ReportsAPIClass/src/MarketplaceWebService/Client.php 上 第 1605 行"

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

        //===========================GETS REPORT ID     
        $request_report_list = new MarketplaceWebService_Model_GetReportListRequest();
        $request_report_list->setMerchant($MERCHANT_ID);
        $request_report_list->setAcknowledged(false);
        $request_report_list->setMarketplace($MARKETPLACE_ID);
        $request_report_list->setReportTypeList(array("TypeList" => "_GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_"));

【问题讨论】:

  • 删除行号中的“getType()”后工作正常。 Client.php 中的 1605 所以从 foreach ($reportTypeList->getType() as $typeIndex => $type) 到 "foreach ($reportTypeList as $typeIndex => $type)"

标签: php api amazon-web-services amazon amazon-mws


【解决方案1】:

你必须创建一个 typelist 类型的类并作为参数发送

$TypeList = new MarketplaceWebService_Model_TypeList();
$TypeList->setType('_GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_');
$request_report_list->setReportTypeList($TypeList);

【讨论】:

  • 删除行号中的“getType()”后工作正常。 Client.php 中的 1605 所以从 foreach ($reportTypeList->getType() as $typeIndex => $type) 到 "foreach ($reportTypeList as $typeIndex => $type)"
  • 当然可以,不过你换的是官方库,不是库的问题,问题是参数不对,不过如果能用就不用担心了。
  • 哦,谢谢@mameyugo,我希望亚马逊开始着手编写更好的 API 文档。
猜你喜欢
  • 1970-01-01
  • 2023-03-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多