搜索新服务的亚马逊亚马逊的例子 [英] Search amazon example with new amazon service

查看:222
本文介绍了搜索新服务的亚马逊亚马逊的例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到(或至少,在过去几年)的新服务亚马逊的工作示例。最近的工作例如刚回来与空项不管我把标题。该代码是:

I can not find a working example of the new amazon service (or at least, within the last couple of years). The closest working example just comes back with a null item no matter what I put in the title. The code is:

        // Amazon ProductAdvertisingAPI client
        AWSECommerceServicePortTypeClient amazonClient = new AWSECommerceServicePortTypeClient();

        // prepare an ItemSearch request
        ItemSearchRequest request = new ItemSearchRequest();
        request.SearchIndex = "Books";
        request.Title = "C#";
        request.Condition = Condition.All;
        //request.ResponseGroup = new string[] { "Small" };

        ItemSearch itemSearch = new ItemSearch();
        itemSearch.Request = new ItemSearchRequest[] { request };
        itemSearch.AWSAccessKeyId = ConfigurationManager.AppSettings["accessKeyId"];

        // send the ItemSearch request
        ItemSearchResponse response = amazonClient.ItemSearch(itemSearch);

        // write out the results from the ItemSearch request
        foreach (var itemLst in response.Items)
        {
            if (itemLst.Item != null)
            {
                foreach (var item in response.Items[0].Item)
                {
                    Console.WriteLine(item.ItemAttributes.Title);
                }
            }
            else
                Console.WriteLine("No item info was found for this response list item.");
        }
        Console.WriteLine("<Done...press enter to continue>");
        Console.ReadLine();



我在做什么错了?

What am I doing wrong?

推荐答案

我相信你的问题可能是缺乏准标记的。截至2011年11月,这是必需的所有请求,我在我的测试,我得到了空响应返回(有错误代码)时,我并没有包括它注意到早期。我不知道如果这仍然是行为,但我肯定会认为,如果你不添加它(我没有在你的代码中看到的),这是一个可能的嫌疑人。

I believe your problem may be lack of an Associate Tag. As of November, 2011, this is required for all requests and I noticed early on in my testing that I got null responses back (with an error code) when I didn't include it. I'm not sure if that's still the behavior but I'd definitely assume that if you aren't adding it (which I don't see in your code) that's a likely suspect.

看看顶部变动说明这里

如果你没有一个副ID,您需要申请一个。

If you don't have an Associate ID you will need to apply for one.

这篇关于搜索新服务的亚马逊亚马逊的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆