Example #1
0
        public async Task ItemSearch()
        {
            //create a WCF Amazon ECS client
            AWSECommerceServiceClient client = new AWSECommerceServiceClient();

            //prepare an ItemSearchRequest to search for
            ItemSearchRequest requestPage1 = new ItemSearchRequest()
            {
                SearchIndex   = SearchIndex.All.ToString(),
                Keywords      = "AbilityOne",
                ItemPage      = "20",
                ResponseGroup = new string[]
                {
                    //ResponseGroup.Images.ToString(),
                    ResponseGroup.ItemAttributes.ToString(),
                    //ResponseGroup.Offers.ToString()
                },
            };
            ItemSearchRequest requestPage2 = new ItemSearchRequest()
            {
                SearchIndex   = SearchIndex.All.ToString(),
                Keywords      = "AbilityOne",
                ItemPage      = "21",
                ResponseGroup = new string[]
                {
                    //ResponseGroup.Images.ToString(),
                    ResponseGroup.ItemAttributes.ToString(),
                    //ResponseGroup.Offers.ToString()
                },
            };

            //prepare an ItemSearch
            ItemSearch itemSearch = new ItemSearch()
            {
                Request        = new ItemSearchRequest[] { requestPage1, requestPage2 },
                AssociateTag   = AmazonInformation.GetAssociateTag(),
                AWSAccessKeyId = AmazonInformation.GetAccessKeyID(),
            };

            // issue the ItemSearch request
            ItemSearchResponse response = client.ItemSearch(itemSearch);

            /*itemSearch.Request[0].Keywords = "7920-00-543-6492";
             *
             * ItemSearchResponse response2 = client.ItemSearch(itemSearch);*/
        }
Example #2
0
        public async Task ItemLookup()
        {
            //create a WCF Amazon ECS client
            AWSECommerceServiceClient client = new AWSECommerceServiceClient();

            //prepare an ItemLookupRequest
            ItemLookupRequest request = new ItemLookupRequest()
            {
                IdType = ItemLookupRequestIdType.ASIN,
                ItemId = new string[] { "B002NF0KI2" },
            };

            //prepare an ItemLookup
            ItemLookup itemLookup = new ItemLookup()
            {
                Request        = new ItemLookupRequest[] { request },
                AssociateTag   = AmazonInformation.GetAssociateTag(),
                AWSAccessKeyId = AmazonInformation.GetAccessKeyID(),
            };

            // issue the ItemLookup request
            ItemLookupResponse response = client.ItemLookup(itemLookup);

            if (response.Items[0].Request.Errors.Length > 0)
            {
                foreach (ErrorsError error in response.Items[0].Request.Errors)
                {
                    Debug.WriteLine(error.Message);
                }
            }
            else
            {
                foreach (var item in response.Items[0].Item)
                {
                    Debug.WriteLine(item.ItemAttributes.Title);
                }
            }
        }