通过 UPC 进行商品查找的 Amazon Web 服务

发布于 2024-08-23 12:24:48 字数 959 浏览 11 评论 0原文

我的工作环境是 Visual Studio 2008 + C#

我正在使用 Amazon WebService,我想使用 SOAP 从 Amazon 获取数据,但是当我尝试传递 IDType = UPC 时,它给了我以下错误消息,那么我该怎么办?

错误:

036725229884 不是 ItemId 的有效值。请更改此值并重试您的请求

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

注意: 如何添加多个 SearchIndex,例如(“书籍”、“照片”、“视频”)?

我使用了以下WebService: http://webservices.amazon.com/AWSECommerceService/2009- 11-01/US/AWSECommerceService.wsdl

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伪心 2024-08-30 12:24:48

还要注意 UPC 和 EAN 之间的差异。

UPC = 12 位数字,
EAN = 13 位数字

如果您只是在 Amazon.com 上输入 UPC 738678251584(12 位数字)或 EAN 3253581057803(13 位数字),则两者都会在 Amazon.com 中显示为 UPC描述,但使用 API 时,您必须在搜索时指定 EAN。

我们有同时具有这两种功能的产品,您需要相应地指定搜索类型,否则将找不到。

编辑:或者您可以在任意 12 位数字前面添加 0,并始终搜索 EAN。这可能是最好的解决方案。根据定义 "0" + UPC = EAN

此请求对我有用(searchType 是 UPC 或 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 };

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 };
甜尕妞 2024-08-30 12:24:48

我认为亚马逊不支持跨多个搜索索引的查询。但是,有一个名为 All特殊索引> 您可以将其与 UPC 查找一起使用。此索引使用的参数有一些限制,但由于您为 MerchantIdCondition 指定了 All,因此它可能会起作用。如果没有,您可以在不使用这些参数的情况下执行查询,然后在获得您感兴趣的 UPC 的 ASIN 后发出新查询。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文