2016-09-21 50 views
0

我試圖只更新一個項目的描述。亞馬遜MWS API的PartialUpdate需要所有XML元素

這是我的要求:

<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amznenvelope.xsd"> 
        <Header> 
         <DocumentVersion>1.01</DocumentVersion> 
         <MerchantIdentifier>ABCDEFGH</MerchantIdentifier> 
        </Header> 
    <MessageType>Product</MessageType> 
      <PurgeAndReplace>false</PurgeAndReplace> 
        <Message> 
         <MessageID>1</MessageID> 
         <OperationType>PartialUpdate</OperationType> 
         <Product> 
          <SKU>my_sku</SKU> 
          <StandardProductID> 
           <Type>ASIN</Type> 
           <Value>B009XXXXX</Value> 
          </StandardProductID> 
          <Condition> 
           <ConditionType>New</ConditionType> 
           <ConditionNote>New</ConditionNote> 
          </Condition> 
          <Description>My Description</Description> 
         </Product> 
        </Message> 
    </AmazonEnvelope> 

亞馬遜的迴應:

   <DocumentVersion>1.02</DocumentVersion> 
       <MerchantIdentifier>M_MyCompany</MerchantIdentifier> 
     </Header> 
     <MessageType>ProcessingReport</MessageType> 
     <Message> 
       <MessageID>1</MessageID> 
       <ProcessingReport> 
         <DocumentTransactionID>5551401111</DocumentTransactionID> 
         <StatusCode>Complete</StatusCode> 
         <ProcessingSummary> 
           <MessagesProcessed>1</MessagesProcessed> 
           <MessagesSuccessful>0</MessagesSuccessful> 
           <MessagesWithError>1</MessagesWithError> 
           <MessagesWithWarning>0</MessagesWithWarning> 
         </ProcessingSummary> 
         <Result> 
           <MessageID>1</MessageID> 
           <ResultCode>Error</ResultCode> 
           <ResultMessageCode>5000</ResultMessageCode> 
           <ResultDescription>XML Parsing Error at Line 20, Column 33: cvc-complex-type.2.4.a: Invalid content was found starting with element &apos;Description&apos;. One of &apos;{Rebate, ItemPackageQuantity, NumberOfItems, LiquidVolume, DescriptionData, PromoTag, DiscoveryData, ProductData, ShippedByFreight, EnhancedImageURL, Amazon-Vendor-Only, Amazon-Only, RegisteredParameter}&apos; is expected.</ResultDescription> 
           <AdditionalInfo> 
             <SKU>my_sku</SKU> 
           </AdditionalInfo> 
         </Result> 
       </ProcessingReport> 

這似乎是說,我需要提供所有的元素?儘管我只是想更新描述。

回答

1

響應告訴你所有的字段,可能出現在它發現「描述」的地方。進行部分更新時不必包含所有信息。所需的最小數據是SKU和DescriptionData/Title。

的問題是,說明已經走了DescriptionData標籤和標題內是必需的,象下面這樣:

<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amznenvelope.xsd"> 
       <Header> 
        <DocumentVersion>1.01</DocumentVersion> 
        <MerchantIdentifier>ABCDEFGH</MerchantIdentifier> 
       </Header> 
<MessageType>Product</MessageType> 
     <PurgeAndReplace>false</PurgeAndReplace> 
       <Message> 
        <MessageID>1</MessageID> 
        <OperationType>PartialUpdate</OperationType> 
        <Product> 
         <SKU>my_sku</SKU> 
         <StandardProductID> 
          <Type>ASIN</Type> 
          <Value>B009XXXXX</Value> 
         </StandardProductID> 
         <Condition> 
          <ConditionType>New</ConditionType> 
         </Condition> 
         <DescriptionData> 
          <Title>Title should go here. It is required.</Title> 
          <Description>My Description</Description> 
         </DescriptionData> 
        </Product> 
       </Message> 
</AmazonEnvelope>