Amazon SP_API POST CRETEREPORT()响应返回无效输入

发布于 2025-01-25 09:34:18 字数 1862 浏览 0 评论 0原文

我正在尝试创建报告,以便我可以大量进口产品。我现在面临的问题是,我所做的一切始终都会收到无效的输入错误。似乎我已经检查了问题而且一次类似,但不幸的是没有解决方案。

因此,如果您检查以下从SP-API收到的错误,

{
    "notifications": [],
    "text": "{\"message\":\"[400] [{\\\"code\\\":\\\"InvalidInput\\\",\\\"message\\\":\\\"Could not match input arguments\\\"}]\",\"success\":false}"
}

您会注意到我的代码上关于数据类型的代码似乎存在一个错误(正如我从错误中理解的),但是我已经确保了很多数据类型,即使我已经将数据作为字符串写了[]但是说实话,花了太多时间。请找到我的代码

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

顺便说一句,我正在使用此lib https://github.com/jlevers/jlevers/selling/sellow -partner-api 请注意,createreportspecerification参数的3个是可选的(report_options,data_start_time,data_end_time),我没有在constructor上传递它。

您能建议我的代码出了什么问题吗?为什么我会收到无效的输入?

提前致谢

I am trying to create a report so I can import products in bulk. The issue i am facing right now is that whatever I have done always got Invalid input error. It seems very very ambiguous error message I have checked issue here and similar once but unfortunately no solution worked.

So if you check below received error from sp-api

{
    "notifications": [],
    "text": "{\"message\":\"[400] [{\\\"code\\\":\\\"InvalidInput\\\",\\\"message\\\":\\\"Could not match input arguments\\\"}]\",\"success\":false}"
}

you will notice that it seems there is a mistake with my code regarding datatype(as I understood from error) But I have made sure many times of datatype, even I have wrote data as string[] but honestly it took too much time. Please find my code

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

Btw, I am using this lib https://github.com/jlevers/selling-partner-api
Please note that 3 of CreateReportSpecification parameter are optional (report_options, data_start_time, data_end_time) I didn't passed it at constructor.

Could you please advise what's went wrong with my code? Why I am receiving Invalid Input ??

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

把人绕傻吧 2025-02-01 09:34:18

检查aws_env =生产(不是沙箱)

Check that AWS_ENV=PRODUCTION (not SANDBOX)

深海不蓝 2025-02-01 09:34:18
'marketplace_ids' => [$merchant_data['marketplace_ids']],

除非$ merchant_data ['marketplace_ids']是一个字符串,否则您可能不需要周围的数组

'marketplace_ids' => [$merchant_data['marketplace_ids']],

You probably don't need the surrounding array for this unless $merchant_data['marketplace_ids'] is a single string

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文