4

我正在使用亚马逊的 MWS 提交产品库存,但它似乎并没有工作,尽管它说它有。

我使用“SubmitFeed”提交我已粘贴在下面的测试提要 XML;

<?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>A1BJ5TNE5I3MUD</MerchantIdentifier>
  </Header>
  <MessageType>Product</MessageType>
  <PurgeAndReplace>true</PurgeAndReplace>
  <Message>
    <MessageID>1</MessageID>
    <OperationType>Insert</OperationType>
    <Product>
      <SKU>56789</SKU>
      <StandardProductID>
        <Type>ASIN</Type>
        <Value>B0EXAMPLEG</Value>
      </StandardProductID>
      <ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
      <DescriptionData>
        <Title>Example Product Title</Title>
        <Brand>Example Product Brand</Brand>
        <Description>This is an example product description.</Description>
        <BulletPoint>Example Bullet Point 1</BulletPoint>
        <BulletPoint>Example Bullet Point 2</BulletPoint>
        <MSRP currency="USD">99.99</MSRP>
        <Manufacturer>Example Product Manufacturer</Manufacturer>
        <ItemType>example-item-type</ItemType>
      </DescriptionData>
      <ProductData>
        <Health>
          <ProductType>
            <HealthMisc>
              <Ingredients>Example Ingredients</Ingredients>
              <Directions>Example Directions</Directions>
            </HealthMisc>
          </ProductType>
        </Health>
      </ProductData>
    </Product>
  </Message>
</AmazonEnvelope>

这似乎工作正常,它返回“FeedSubmissionId”等......

<?xml version="1.0"?>
<SubmitFeedResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
    <SubmitFeedResult>
        <FeedSubmissionInfo>
            <FeedSubmissionId>3008008200</FeedSubmissionId>
            <FeedType>_POST_PRODUCT_DATA_</FeedType>
            <SubmittedDate>2012-03-29T11:12:04+00:00</SubmittedDate>
            <FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus>
        </FeedSubmissionInfo>
    </SubmitFeedResult>
    <ResponseMetadata>
        <RequestId>9ff22ff1-e86b-45a1-b1ce-4b873f45e90a</RequestId>
    </ResponseMetadata>
</SubmitFeedResponse>

然后我使用“GetFeedSubmissionList”检查提要提交的状态,它返回“ DONE ”....

<?xml version="1.0"?>
<GetFeedSubmissionListResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
    <GetFeedSubmissionListResult>
        <NextToken />
        <HasNext>false</HasNext>
        <FeedSubmissionInfo>
            <FeedSubmissionId>3008008200</FeedSubmissionId>
            <FeedType>_POST_PRODUCT_DATA_</FeedType>
            <SubmittedDate>2012-03-29T11:12:04+00:00</SubmittedDate>
            <FeedProcessingStatus>_DONE_</FeedProcessingStatus>
            <StartedProcessingDate>2012-03-29T11:12:13+00:00</StartedProcessingDate>
            <CompletedProcessingDate>2012-03-29T11:12:33+00:00</CompletedProcessingDate>
        </FeedSubmissionInfo>
    </GetFeedSubmissionListResult>
    <ResponseMetadata>
        <RequestId>4afd9b3d-33c6-4c15-bbe1-51304dc1cd24</RequestId>
    </ResponseMetadata>
</GetFeedSubmissionListResponse>

但是当我登录到卖家中心并查看库存时,测试产品不在那里。我似乎无法在任何地方找到它 - 那么它到底提交到哪里?我绝对没有混淆任何商家 ID - 因为我是通过同一个帐户进行的,授权开发者帐户使用卖家帐户等。

有什么我做的不对吗?我需要调用另一个函数来提交数据吗?

这真的很令人沮丧,因为亚马逊的文档太糟糕了。多亏了 Stackoverflow 和那里的随机博客文章,我实际上已经走到了这一步。

4

5 回答 5

4

您确实需要更改此提要中的一些内容,但这只是一个起点。

第一的 ....

<PurgeAndReplace>false</PurgeAndReplace> // unless you want to delete all other inventory
  <Message>
    <MessageID>1</MessageID>
    <OperationType>Update</OperationType> //instead of insert

下一步... 如果您知道要将 SKU 映射到的确切 ASIN,请仅使用下一部分。

<StandardProductID>
   <Type>ASIN</Type>
   <Value>B0EXAMPLEG</Value>
</StandardProductID>

然后……验证上传是否成功。“完成”不是一回事。您需要执行 GetFeedSubmissionResult,这是一个文件下载,并检查内容

<ProcessingSummary>
    <MessagesProcessed>1</MessagesProcessed>
    <MessagesSuccessful>1</MessagesSuccessful>
    <MessagesWithError>0</MessagesWithError>
    <MessagesWithWarning>0</MessagesWithWarning>
</ProcessingSummary>

最重要的是......与使用 XML 进行平面文件上传和仅使用产品 Feed 不同,它不会创建列表。

您还必须创建库存(带数量)和价格信息,以创建可通过卖家中心页面查看的要约清单。

于 2012-11-16T00:57:20.917 回答
1

我同意文档需要更多的工作。您的 XML 看起来不错,尽管我使用“更新”的 OperationType。

下载报告已完成 ( DONE ),因此您只需使用 GetFeedSubmissionResultRequest() 下载错误报告,它会以数据流的形式返回报告。亚马逊提交的过程分为三个阶段,上传、状态和下载。因此,您需要检查您的提交是否有错误。

在卖家中心有一个上传区域,您的请求将在其中显示。它位于库存 > 上传产品和库存中。希望这有助于我使用英国版本。

于 2012-04-01T16:27:04.337 回答
1

我不熟悉使用 XML 格式上传数据,但从第 35 页的XML 指南(使用 XML 管理列表)中列出了您缺少的两个字段:

发布日期:控制产品何时出现在亚马逊网站上的搜索和浏览中
发布日期:产品发布销售的日期

我想知道该项目是否会出现在您的库存报告中而没有打开日期,即使它没有出现在其他任何地方。由于您没有指定这些字段中的任何一个,因此可以想象该商品已列在您的库存中(在库存报告中),但买家看不到。

于 2012-03-29T21:50:41.817 回答
1

XML 看起来不错,您是否尝试将 RBN 添加到项目中?还将 PurgeAndReplace 设置为 false,并将 OperationType 设置为 Update(如上所述)。

<Header>
    <DocumentVersion>1.01</DocumentVersion>
    <MerchantIdentifier>AMZ ID</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<PurgeAndReplace>false</PurgeAndReplace>
<Message>
    <MessageID>1</MessageID>
    <OperationType>Update</OperationType>
    <Product>
        <SKU>ABFOB.12YOV1</SKU>
        <StandardProductID>
            <Type>ASIN</Type>
            <Value>B001P4WGQ6</Value>
        </StandardProductID>
        <LaunchDate>2012-06-18T04:59:29+01:00</LaunchDate>
        <DescriptionData>
            <Title>Aberfeldy 12 Year Old / 70cl</Title>
            <Brand>Aberfeldy</Brand>
            <Description>An award winning Eastern Highland malt that was almost unknown until it was bought by Bacardi in 1998, Aberfeldy's main claim to fame is as the heart of the excellent Dewar's blend.  Clean and polished malt with a touch of honey and spice.    Web-Exclusive Price!</Description>
            <BulletPoint>12 Years Old</BulletPoint>
            <BulletPoint>Bottled by Distillery Bottling</BulletPoint>
            <PackageWeight unitOfMeasure="KG">1.50</PackageWeight>
            <Manufacturer>Aberfeldy</Manufacturer>
            <ItemType>AlcoholicBeverages</ItemType>
            <RecommendedBrowseNode>359893031</RecommendedBrowseNode>
        </DescriptionData>
        <ProductData>
            <FoodAndBeverages>
                <ProductType>
                    <AlcoholicBeverages>
                        <CountryProducedIn>Scotland</CountryProducedIn>
                        <RegionOfOrigin>Highland</RegionOfOrigin>
                        <AlcoholContent unitOfMeasure="percent_by_volume">40.00</AlcoholContent>
                    </AlcoholicBeverages>
                </ProductType>
            </FoodAndBeverages>
        </ProductData>
    </Product>
</Message>

以上只是我发布的 XML 示例。看看这是否有帮助,希望有帮助!

我同意其他人的观点,即 API 完全是一团糟,使用起来简直就是一场噩梦。我发现自己多次将头撞到墙上,但是说当它起作用时,它确实很好用:)

于 2012-07-20T08:50:56.780 回答
0

尝试像我一样研究结果。发送请求后,您可以查看 file.xml 会有一些错误

/**
 *  PHP Version 5
 *
 *  @category    Amazon
 *  @package     MarketplaceWebService
 *  @copyright   Copyright 2009 Amazon Technologies, Inc.
 *  @link        http://aws.amazon.com
 *  @license     http://aws.amazon.com/apache2.0  Apache License, Version 2.0
 *  @version     2009-01-01
 */
/*******************************************************************************

 *  Marketplace Web Service PHP5 Library
 *  Generated: Thu May 07 13:07:36 PDT 2009
 *
 */

/**
 * Get Feed Submission Result  Sample
 */

include_once('MarketplaceWebService/Samples/.config.inc.php');

/************************************************************************
 * Uncomment to configure the client instance. Configuration settings
 * are:
 *
 * - MWS endpoint URL
 * - Proxy host and port.
 * - MaxErrorRetry.
 ***********************************************************************/
// IMPORTANT: Uncomment the appropriate line for the country you wish to
// sell in:
// United States:
$serviceUrl = "https://mws.amazonservices.com";
// United Kingdom
//$serviceUrl = "https://mws.amazonservices.co.uk";
// Germany
//$serviceUrl = "https://mws.amazonservices.de";
// France
//$serviceUrl = "https://mws.amazonservices.fr";
// Italy
//$serviceUrl = "https://mws.amazonservices.it";
// Japan
//$serviceUrl = "https://mws.amazonservices.jp";
// China
//$serviceUrl = "https://mws.amazonservices.com.cn";
// Canada
//$serviceUrl = "https://mws.amazonservices.ca";
// India
//$serviceUrl = "https://mws.amazonservices.in";

$config = array (
    'ServiceURL' => $serviceUrl,
    'ProxyHost' => null,
    'ProxyPort' => -1,
    'MaxErrorRetry' => 3,
);

/************************************************************************
 * Instantiate Implementation of MarketplaceWebService
 *
 * AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY constants
 * are defined in the .config.inc.php located in the same
 * directory as this sample
 ***********************************************************************/
$service = new MarketplaceWebService_Client(
    AWS_ACCESS_KEY_ID,
    AWS_SECRET_ACCESS_KEY,
    $config,
    APPLICATION_NAME,
    APPLICATION_VERSION);

/************************************************************************
 * Uncomment to try out Mock Service that simulates MarketplaceWebService
 * responses without calling MarketplaceWebService service.
 *
 * Responses are loaded from local XML files. You can tweak XML files to
 * experiment with various outputs during development
 *
 * XML files available under MarketplaceWebService/Mock tree
 *
 ***********************************************************************/
// $service = new MarketplaceWebService_Mock();

/************************************************************************
 * Setup request parameters and uncomment invoke to try out
 * sample for Get Feed Submission Result Action
 ***********************************************************************/
// @TODO: set request. Action can be passed as MarketplaceWebService_Model_GetFeedSubmissionResultRequest
// object or array of parameters

/*$parameters = array (
    'Merchant' => MERCHANT_ID,
    'FeedSubmissionId' => 'xxxxxx',
    'FeedSubmissionResult' => @fopen('php://memory', 'rw+'),
);

$request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest($parameters);*/

$filename = __DIR__.'/file.xml';
$handle = fopen($filename, 'w+');
$request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest();
$request->setMerchant(MERCHANT_ID);
$request->setFeedSubmissionId('7763576008');
$request->setFeedSubmissionResult($handle);


try {
    $response = $service->getFeedSubmissionResult($request);
    fclose($handle);


    echo ("Service Response\n");
    echo ("=============================================================================\n");

    echo("        GetFeedSubmissionResultResponse\n");
    if ($response->isSetGetFeedSubmissionResultResult()) {
        $getFeedSubmissionResultResult = $response->getGetFeedSubmissionResultResult();
        echo ("            GetFeedSubmissionResult");

        if ($getFeedSubmissionResultResult->isSetContentMd5()) {
            echo ("                ContentMd5");
            echo ("                " . $getFeedSubmissionResultResult->getContentMd5() . "\n");
        }
    }
    if ($response->isSetResponseMetadata()) {
        echo("            ResponseMetadata\n");
        $responseMetadata = $response->getResponseMetadata();
        if ($responseMetadata->isSetRequestId())
        {
            echo("                RequestId\n");
            echo("                    " . $responseMetadata->getRequestId() . "\n");
        }
    }

    echo("            ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");
} catch (MarketplaceWebService_Exception $ex) {
    echo("Caught Exception: " . $ex->getMessage() . "\n");
    echo("Response Status Code: " . $ex->getStatusCode() . "\n");
    echo("Error Code: " . $ex->getErrorCode() . "\n");
    echo("Error Type: " . $ex->getErrorType() . "\n");
    echo("Request ID: " . $ex->getRequestId() . "\n");
    echo("XML: " . $ex->getXML() . "\n");
    echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");
}
于 2013-08-15T12:05:25.747 回答