【发布时间】:2022-06-11 21:05:53
【问题描述】:
我正在尝试创建一份报告,以便批量导入产品。我现在面临的问题是,无论我做什么,总是会出现无效输入错误。我在这里检查了issue 和类似的一次似乎非常非常模棱两可的错误消息,但不幸的是没有解决方案。
所以如果你检查下面从 sp-api 收到的错误
{
"notifications": [],
"text": "{\"message\":\"[400] [{\\\"code\\\":\\\"InvalidInput\\\",\\\"message\\\":\\\"Could not match input arguments\\\"}]\",\"success\":false}"
}
你会注意到我的代码似乎有一个关于数据类型的错误(正如我从错误中理解的那样)但是我已经确定了很多次数据类型,即使我已经将数据写为 string[] 但老实说它花了太多时间时间。请找到我的代码
$config = new Configuration([
"lwaClientId" => $account_data['lwa_client_id'],
"lwaClientSecret" => $account_data['lwa_client_secret'],
"lwaRefreshToken" => $account_data['lwa_refresh_token'],
"awsAccessKeyId" => $account_data['aws_access_key'],
"awsSecretAccessKey" => $account_data['aws_secret_key'],
"endpoint" => SellingPartnerApi\Endpoint::NA ,
]);
$apiInstance = new SellingPartnerApi\Api\ReportsApi($config);
$body = new SellingPartnerApi\Model\Reports\CreateReportSpecification([
'marketplace_ids' => [$merchant_data['marketplace_ids']],
'report_type' => ReportType::GET_MERCHANT_LISTINGS_ALL_DATA['name'],
]);
try{
$report_id = $apiInstance->createReport($body);
}catch(Exception $e){
return array("message"=>$e->getMessage(),'success'=>false);
}
顺便说一句,我正在使用这个库https://github.com/jlevers/selling-partner-api 请注意,CreateReportSpecification 参数中的 3 个是可选的(report_options、data_start_time、data_end_time)我没有在构造函数中传递。
您能否告知我的代码出了什么问题?为什么我收到无效输入??
提前致谢
【问题讨论】:
标签: php amazonsellercentral amz-sp-api