Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapping amazon product category to the correct category XSD

Within the _POST_PRODUCT_DATA_ feed the "ProductData" node contains data that is specific to the category that the item is within. How exactly though should the category the item is in be mapped to an XSD as there doesn't (always) seem to be a direct relationship. Calling "GetProductCategoriesForASIN" doesn't seem to help much either - what's with ProductCategoryName of "Categories"? (as below)

<?xml version="1.0"?>
<GetProductCategoriesForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">
<GetProductCategoriesForASINResult>
  <Self>
    <ProductCategoryId>166099011</ProductCategoryId>
    <ProductCategoryName>Building Sets</ProductCategoryName>
    <Parent>
      <ProductCategoryId>166092011</ProductCategoryId>
      <ProductCategoryName>Building Toys</ProductCategoryName>
      <Parent>
        <ProductCategoryId>165795011</ProductCategoryId>
        <ProductCategoryName>Categories</ProductCategoryName>
        <Parent>
          <ProductCategoryId>165793011</ProductCategoryId>
          <ProductCategoryName>Categories</ProductCategoryName>
        </Parent>
      </Parent>
    </Parent>
  </Self>
</GetProductCategoriesForASINResult>
<ResponseMetadata>
  <RequestId>0ce91472-4234-4222-8fd8-d56714db18ba</RequestId>
</ResponseMetadata>
</GetProductCategoriesForASINResponse>

In short what i'm really wanting to know is how, for a new product or one with an existing ASIN, to take the category ID or name and map this to the correct XSD so the correct set of category specific options can be returned.

Thanks.

like image 770
robjmills Avatar asked Jul 03 '13 09:07

robjmills


2 Answers

Warning This is a fragile workaround at best - you have been warned!

There is no direct mapping from the ProductCategoryId to the XSD. However, there is roughly a one-to-one mapping between BTG (Browse Tree Guide)* and the Product XSD files* (minus the BMVD¹ categories).

The BTG's Node ID column corresponds to the ProductCategoryId. Once you find out which BTG the Self category belongs to you could safely assume that the corresponding XSD file is the correct one.

For example, the Self > ProductCategoryId of 166099011 is found in the Toys and Games BTG which corresponds to the Toys and Games XSD

¹Books, Music, Videos, and DVDs
*Must be signed into your Seller Central account to access

like image 145
Jonathan Spooner Avatar answered Sep 22 '22 23:09

Jonathan Spooner


If I understand your question, you are asking if there is any way to tell what kind of <ProductData> you should put into your _POST_PRODUCT_DATA_ feed for a specific product.

E.g. for ASIN B008HRVM5U, should it be

<ProductData>
   <Home>
      <ProductType>
         <Kitchen>...</Kitchen>
      </ProductType>
   </Home>
</ProductData>

or rather

<ProductData>
   <Baby>
      <ProductType>
          <BabyProducts>...</BabyProducts>
      </ProductType>
   </Baby>
</ProductData>

To the best of my knowledge, there is no way to actually find out - neither through MWS nor Seller Central. At the same time, the correct matching of XML structures matters a lot... I've spent a total of three weeks trying to figure out why certain products were behaving funnily (you couldn't actually buy them). In the end, I had to contact Amazon support to find out I was using the 'wrong' XML structure for the specific category I was trying to list in.

like image 27
Hazzit Avatar answered Sep 25 '22 23:09

Hazzit