亚马逊MWS产品饲料与关系

时间:2016-08-23 17:12:40

标签: xml amazon-web-services amazon-mws amazon-product-api

我可以使用此feed.xml文件将我的产品成功上传到Amazon。

<?xml version="1.0" encoding="iso-8859-1"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
  <Header>
    <DocumentVersion>1.01</DocumentVersion>
    <MerchantIdentifier>MERCHANTID</MerchantIdentifier>
  </Header>
  <MessageType>Product</MessageType>
  <PurgeAndReplace>false</PurgeAndReplace>
  <Message>
    <MessageID>1</MessageID>
    <OperationType>Update</OperationType>
    <Product>
      <SKU>56791</SKU>
      <StandardProductID>
        <Type>UPC</Type>
        <Value>1234567890</Value>
      </StandardProductID>
      <Condition>   
        <ConditionType>New</ConditionType>
      </Condition>
      <DescriptionData>
        <Title>Yougurt Covered Raisins 300</Title>
        <Brand>Valued Naturals</Brand>
        <Description>Quality you can see and taste</Description>
        <BulletPoint>Contains milk and soy</BulletPoint>
        <BulletPoint>Gluten Free</BulletPoint>
        <BulletPoint>Kosher</BulletPoint>
        <Manufacturer>IFood</Manufacturer>
        <ItemType>raisins</ItemType>
      </DescriptionData>
      <ProductData>
        <FoodAndBeverages>
          <ProductType>
            <Food>
              <VariationData>
                        <Parentage>parent</Parentage> 
                        <VariationTheme>Size</VariationTheme>
                        <Size>100</Size>
                    </VariationData>
              <UnitCount unitOfMeasure="GR">396</UnitCount>
            </Food>
          </ProductType>
        </FoodAndBeverages>
      </ProductData>
    </Product>
  </Message>

<Message>
    <MessageID>2</MessageID>
    <OperationType>Update</OperationType>
    <Product>
      <SKU>56791-300</SKU>
      <StandardProductID>
        <Type>UPC</Type>
        <Value>1234567890</Value>
      </StandardProductID>
      <Condition>   
            <ConditionType>New</ConditionType>
        </Condition>
      <DescriptionData>
        <Title>Yougurt Covered Raisins 300gr</Title>
        <Brand>Valued Naturals</Brand>
        <Description>Quality you can see and taste</Description>
        <BulletPoint>Contains milk and soy</BulletPoint>
        <BulletPoint>Gluten Free</BulletPoint>
        <BulletPoint>Kosher</BulletPoint>
        <Manufacturer>IFood</Manufacturer>
        <ItemType>raisins</ItemType>
      </DescriptionData>
      <ProductData>
        <FoodAndBeverages>
          <ProductType>
            <Food>
              <VariationData>
                <Parentage>child</Parentage> 
                <VariationTheme>Size</VariationTheme>
                <Size>100</Size>
              </VariationData>
              <UnitCount unitOfMeasure="GR">396</UnitCount>
            </Food>
          </ProductType>
        </FoodAndBeverages>
      </ProductData>
    </Product>
  </Message>
  <Message>
    <MessageID>3</MessageID>
    <OperationType>Update</OperationType>
    <Product>
      <SKU>56791-100</SKU>
      <StandardProductID>
        <Type>UPC</Type>
        <Value>1234567890</Value>
      </StandardProductID>
      <Condition>   
            <ConditionType>New</ConditionType>
        </Condition>
      <DescriptionData>
        <Title>Yougurt Covered Raisins 100gr</Title>
        <Brand>Valued Naturals</Brand>
        <Description>Quality you can see and taste</Description>
        <BulletPoint>Contains milk and soy</BulletPoint>
        <BulletPoint>Gluten Free</BulletPoint>
        <BulletPoint>Kosher</BulletPoint>
        <Manufacturer>IFood</Manufacturer>
            <ItemType>raisins</ItemType>
      </DescriptionData>
      <ProductData>
        <FoodAndBeverages>
          <ProductType>
            <Food>
              <VariationData>
                    <Parentage>child</Parentage> 
                    <VariationTheme>Size</VariationTheme>
                    <Size>100</Size>
                    </VariationData>
              <UnitCount unitOfMeasure="GR">100</UnitCount>
            </Food>
          </ProductType>
        </FoodAndBeverages>
      </ProductData>
    </Product>
  </Message>
</AmazonEnvelope> 

在来自亚马逊的成功消息之后,我不得不发布请求,以便定义产品之间的关系,将第二个和第三个产品设置为第一个产品的子产品,如下所示:

<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
  <Header>
    <DocumentVersion>1.01</DocumentVersion>
    <MerchantIdentifier>MYMERCHANTID</MerchantIdentifier>
  </Header>
  <MessageType>Relationship</MessageType>
  <PurgeAndReplace>false</PurgeAndReplace>

  <Message>
    <MessageID>1</MessageID>
    <OperationType>Update</OperationType>
    <Relationship>
      <ParentSKU>56791</ParentSKU>
      <Relation>
        <SKU>56791-300</SKU>
        <Type>Variation</Type>
      </Relation>
      <Relation>
        <SKU>56791-100</SKU>
        <Type>Variation</Type>
      </Relation>
    </Relationship>
  </Message>
</AmazonEnvelope>

现在我想知道是否可以在单个请求中定义所有这些父子关系,例如在第一个feed.xml文件中放置一些额外的数据?

1 个答案:

答案 0 :(得分:2)

可悲的是你无法做到。 MessageType在AmazonEnvelope中必须是唯一的。其中一个信封属于Product类型,另一个属于Relatonship类型。