0

我想使用 amazon sell-partner api 更改产品的图像,但在 createFeed 阶段出现错误!

关于开发环境

Laravel 框架 8.49.1 pkg jlevers/sales-partner-api:3.1

我是日本人,所以文中可能会有一些奇怪的英文。对不起。

我想使用sp api的create feed来更改我在亚马逊上注册产品的图像,但是在create feed阶段出现错误。

但是,在创建提要阶段会发生错误。创建提要之前的创建文档不会产生错误,并返回 200。

代码本身几乎完全取自 jlevers/sales-partner-api,说明遵循官方 github 指南。我是日本人,所以文中可能会有一些奇怪的英文。

错误内容

[400] {"errors": [{"code": "InvalidInput","message": "Invalid request parameters","details": ""}]

除了这个api,我还使用了report api,它没有任何特别的错误,所以我认为这不是客户端ID等必需参数的错误,但错误消息中没有明确说明哪些参数错误,我已经被困在这里两天了,我快疯了......

我试着用英文、日文、中文搜索,但出现类似错误的人并不多,而且github上的issues也没有解决问题,所以没找到。

我想知道是否有人可以告诉我它是什么。

代码

$config = new Configuration([
    "lwaClientId" => config('client_id'),
    "lwaClientSecret" => config('secret_id'),
    "lwaRefreshToken" => config('refresh_token'),
    "awsAccessKeyId" => config('aws_key'),
    "awsSecretAccessKey" => config('aws_secret'),
    "endpoint" => SellingPartnerApi\Endpoint::FE,
]);

$feedType = FeedType::POST_PRODUCT_IMAGE_DATA;
$feedsApi = new FeedsApi($config);

// Create feed document
\Log::debug("before create feed document");
$createFeedDocSpec = new Feeds\CreateFeedDocumentSpecification(['content_type' => $feedType['contentType']]);
$feedDocumentInfo = $feedsApi->createFeedDocument($createFeedDocSpec);
$feedDocumentId = $feedDocumentInfo->getFeedDocumentId();

$feedContents = <<<EOD
<?xml version="1.0" encoding="utf-8" ?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
    <Header>
        <DocumentVersion>1.01</DocumentVersion>
        <MerchantIdentifier>****</MerchantIdentifier>
    </Header>
    <MessageType>ProductImage</MessageType>
    <Message>
        <MessageID>1</MessageID>
        <OperationType>Update</OperationType>
        <ProductImage>
            <SKU>*********</SKU>
            <ImageType>Main</ImageType>
            <ImageLocation>http://***/***.jpg</ImageLocation>
        </ProductImage>
    </Message>
</AmazonEnvelope>
EOD;
$docToUpload = new SellingPartnerApi\Document($feedDocumentInfo, $feedType);
$docToUpload->upload($feedContents);

$body = new Feeds\CreateFeedSpecification([
    'feed_type' => $feedType["name"],
    "marketplace_ids" => ["A1VC38T7YXB528"],
    "input_feed_document_id" => $feedDocumentId,
]);

$apiInstance = new FeedsApi($config);
try {
    $result = $apiInstance->createFeed($body);
    print_r($result);
} catch (Exception $e) {
$res = "";
    \Log::debug('Exception when calling SellersApi->getMarketplaceParticipations: '. $e->getMessage());
}

对不起,我忍不住发布代码,所以我把它上传到了谷歌驱动器。上面的链接是谷歌驱动器。

最后我想知道我是否缺少任何信息来解决这个问题,以便我可以立即纠正它。

链接 jlevers/sales-partner-api 官方文档

4

1 回答 1

0

不确定您是否仍然遇到问题,但是当卖家账户处于非活动/停用状态并且更新您的收费方式并等待 48 小时可能会奏效时,这种错误很常见(尽管令人困惑)。也可以致电亚马逊卖家支持在卖家中心的案例日志中仔细检查或创建案例。

于 2021-10-08T11:13:50.047 回答