private static ItemSearchResponse AmazonRequestByPage(string Keyword, int page, string SearchIndex) { #region Set Amazon Search parameters ItemSearch search = new ItemSearch(); //replace these with your account info search.AssociateTag = "X"; string accessKeyId = "X"; string secretKey = "X"; ItemSearchRequest req = new ItemSearchRequest(); req.ResponseGroup = new string[] { "Medium" }; req.SearchIndex = SearchIndex; req.ItemPage = Convert.ToString(page); req.Keywords = Keyword; req.Availability = ItemSearchRequestAvailability.Available; search.Request = new ItemSearchRequest[] { req }; Amazon.AWSECommerceServicePortTypeClient amzwc = new Amazon.AWSECommerceServicePortTypeClient(); amzwc.ChannelFactory.Endpoint.EndpointBehaviors.Add(new AmazonSigningEndpointBehavior(accessKeyId, secretKey)); try { ItemSearchResponse resp = amzwc.ItemSearch(search); return(resp); } catch (Exception ex) { ItemSearchResponse resp = null; return(resp); } #endregion }
private static ItemSearchResponse AmazonRequestByPage(string Keyword, int page, string SearchIndex) { #region Set Amazon Search parameters ItemSearch search = new ItemSearch(); //replace these with your account info search.AssociateTag = "X"; string accessKeyId="X"; string secretKey="X"; ItemSearchRequest req = new ItemSearchRequest(); req.ResponseGroup = new string[] { "Medium" }; req.SearchIndex = SearchIndex; req.ItemPage = Convert.ToString(page); req.Keywords = Keyword; req.Availability = ItemSearchRequestAvailability.Available; search.Request = new ItemSearchRequest[] { req }; Amazon.AWSECommerceServicePortTypeClient amzwc = new Amazon.AWSECommerceServicePortTypeClient(); amzwc.ChannelFactory.Endpoint.EndpointBehaviors.Add(new AmazonSigningEndpointBehavior(accessKeyId, secretKey)); try { ItemSearchResponse resp = amzwc.ItemSearch(search); return resp; } catch (Exception ex) { ItemSearchResponse resp = null; return resp; } #endregion }