Amazon web service with item lookup by UPC
My Working Envirnment is Visual Studio 2008 + C#
I am working on Amazon WebService, I want to fetch the data from Amazon using SOAP but when I am trying to pass IDType = UPC it gives me below error message, so what can I do for this ?
Error:
036725229884 is not a valid value for ItemId. Please change this value and retry your request
MyCode:
ItemLookupRequest request1 = new ItemLookupRequest();
request1.IdType = ItemLookupRequestIdType.UPC;
request1.IdTypeSpecified = true;
request1.ItemId = new string[] { ProductID };
request1.ResponseGroup = new string[] { "Request", "Large", "OfferFull", "BrowseNodes" };
request1.MerchantId = "All";
request1.Condition = Condition.All;
request1.SearchIndex = "Books";
Note: How can I add multiple SearchIndex like ("Books","Photo","Video")?
I have used following WebService: http://webservices.amazon.com/AWSECommerceService/2009-11-01/US/AWSECommerceService.wsdl
Also be weary of the difference between UPC and EAN.
UPC = 12 digits, EAN = 13 digits
If you just punch in a UPC 738678251584
(12 digits) or EAN 3253581057803
(13 digits) to Amazon.com it will show both as being UPC in the description, but using the API you must specify EAN when searching.
We have products with both and you need to specify the search type accordingly or it won't get found.
Edit : OR you can just prepend a 0 to any 12 digit numbers and always search for EAN. This is probably the best solution. By definition "0" + UPC = EAN
This request worked for me (searchType is either UPC or EAN):
ItemLookup itemLookup = new ItemLookup()
{
AssociateTag = "XXXXX-20",
};
itemLookup.AWSAccessKeyId = ACCESS_ID;
ItemLookupRequest itemLookupRequest = new ItemLookupRequest();
itemLookupRequest.IdTypeSpecified = true;
itemLookupRequest.IdType = searchType;
itemLookupRequest.SearchIndex = "All";
itemLookupRequest.ItemId = upcEanList;
itemLookupRequest.ResponseGroup = new[] { "OfferSummary", "ItemAttributes" };
itemLookup.Request = new ItemLookupRequest[] { itemLookupRequest };
I don't think Amazon supports queries across multiple search indices. However, there is a special index named All
that you can use with UPC lookups. There are some limitations on the parameters used with this index but since you are specifying All
for MerchantId
and Condition
it may work. If not, you could do the query without those parameters and then issue a new query once you have the ASINs for the UPCs you are interested in.
上一篇: 亚马逊产品广告API
下一篇: 通过UPC进行物品查找的亚马逊网络服务