在从Orders API调用方法getOrders()/getOrder()时,我得到了一个错误:“应用程序无法访问部分或所有请求的资源”。
我把代码完全取自https://github.com/jlevers/selling-partner-api。我安装了composer require jlevers/selling-partner-api并按照指令连接到销售伙伴API。
此外,我还尝试调用$result = $apiInstance>getMarketplaceParticipations(),它没有任何特定的错误,所以我不认为这是配置中的错误。
有人能为我指出正确的方向来解决这个问题吗?
代码
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$token = "<TOKEN>";
use SellingPartnerApi\Api\SellersV1Api as SellersApi;
use SellingPartnerApi\Configuration;
use SellingPartnerApi\Endpoint;
$config = new Configuration([
"lwaClientId" => "amzn1.applica..",
"lwaClientSecret" => "<clientSecret>",
"lwaRefreshToken" => $token,
"awsAccessKeyId" => "<accessKey>",
"awsSecretAccessKey" => "<secretAcessKey>",
"endpoint" => Endpoint::FE
]);
$apiInstance = new SellingPartnerApi\Api\OrdersV0Api($config);
$marketplace_ids = array('A1############');
$created_after = '2022-07-27';
try {
$result = $apiInstance->getOrders($marketplace_ids);
print "<pre>";
print_r($result);
print "</pre>";
} catch (Exception $e) {
echo 'Exception when calling OrdersV0Api->getOrders: ', $e->getMessage(), PHP_EOL;
}错误消息
Exception when calling OrdersV0Api->getOrders: [400] { "errors": [ { "code": "InvalidInput", "message": "Application do not have access to some or all requested resource", "details": "" } ] }发布于 2022-08-05 05:55:45
之后以这种格式创建:
$created_after = new \DateTime("2021-10-01");
$after_str = $created_after->format('Y-m-d\TH:i:s\Z');https://stackoverflow.com/questions/73163832
复制相似问题