Amazon web service with item lookup by UPC

女生的网名这么多〃 提交于 2020-01-01 14:07:26

问题


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


回答1:


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 };



回答2:


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.



来源:https://stackoverflow.com/questions/2385082/amazon-web-service-with-item-lookup-by-upc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!