尽管提交了OK,亚马逊的Marketplace Web Service库存仍未出现在卖家中心

时间:2012-03-29 11:18:01

标签: php amazon-web-services amazon-mws

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

我使用“SubmitFeed”提交我在下面粘贴的测试Feed 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”检查Feed提交的状态,然后返回“ 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和随机的博客文章,我实际上已经走到了这一步。

5 个答案:

答案 0 :(得分:4)

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

首先......

<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不同,它不会创建列表。

您还必须执行库存(包含数量)和价格Feed,以便通过卖家中心页面创建可查看的商品列表。

答案 1 :(得分:1)

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

  

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

我想知道如果没有开放日期,该项目是否会显示在您的inventory report中,即使它没有显示在其他任何地方。由于您未指定这些字段中的任何一个,因此可以想象该项目在您的库存中列出(在库存报告中),但买方不可见。

答案 2 :(得分:1)

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

下载报告已完成( DONE ),因此您只需使用GetFeedSubmissionResultRequest()下载错误报告,该报告将报告作为数据流返回。亚马逊提交了一个三阶段流程,上传,状态,然后下载。因此,您需要检查提交内容是否有错误。

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

答案 3 :(得分: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是一个完整的混乱,是一个噩梦。我发现自己多次撞到墙上,但是当它起作用时,它确实很有效:)

答案 4 :(得分: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");
}