【背景】
用代码:
IDictionary<string, string> reqDict = new Dictionary<string, String>(); reqDict["Service"] = "AWSECommerceService"; reqDict["Version"] = awsApiVersion; reqDict["Operation"] = "ItemSearch"; reqDict["ResponseGroup"] = "ItemIds"; //!!! not BrowseNodeId -> is BrowseNode //reqDict["BrowseNodeId"] = subBrowserNodeId; //"3737671" reqDict["BrowseNode"] = subBrowserNodeId; //"3737671" //means the root browser node name reqDict["SearchIndex"] = searchIndex; //"Appliances" //http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemSearch.html //http://docs.aws.amazon.com/AWSECommerceService/latest/DG/AvailabilityParameter.html reqDict["Availability"] = "Available"; reqDict["Condition"] = "All"; //http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemSearch.html //The maximum ItemPage number that can be returned is 10. reqDict["ItemPage"] = itemPage; String awsReqUrl = Sign(reqDict); XmlDocument xmlDocNoXmlns = awsReqUrlToXmlDoc_noXmlns(awsReqUrl);
其中:
SearchIndex=LawnGarden
其中的LawnGarden,是从:
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/BrowseNodeIDs.html
找到的。
结果现在返回结果却是:
<?xml version="1.0"?> <ItemSearchResponse> <OperationRequest> <HTTPHeaders> <Header Name="UserAgent" Value="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E"/> </HTTPHeaders> <RequestId>cca900a0-eb61-4e1b-9d13-178b4eae20a4</RequestId> <Arguments> <Argument Name="Condition" Value="All"/> <Argument Name="Operation" Value="ItemSearch"/> <Argument Name="Service" Value="AWSECommerceService"/> <Argument Name="Signature" Value="lxE/H7aqqqcsezI8mk0WilRD2IFB6xW5ll637wPuBAA="/> <Argument Name="Availability" Value="Available"/> <Argument Name="ItemPage" Value="1"/> <Argument Name="AssociateTag" Value="xxx"/> <Argument Name="BrowseNode" Value="553632"/> <Argument Name="Version" Value="2011-08-01"/> <Argument Name="AWSAccessKeyId" Value="xxx"/> <Argument Name="Timestamp" Value="2013-06-16T15:17:48Z"/> <Argument Name="ResponseGroup" Value="ItemIds"/> <Argument Name="SearchIndex" Value="LawnGarden"/> </Arguments> <RequestProcessingTime>0.0027890000000000</RequestProcessingTime> </OperationRequest> <Items> <Request> <IsValid>False</IsValid> <ItemSearchRequest> <Availability>Available</Availability> <BrowseNode>553632</BrowseNode> <Condition>All</Condition> <ItemPage>1</ItemPage> <ResponseGroup>ItemIds</ResponseGroup> <SearchIndex>LawnGarden</SearchIndex> </ItemSearchRequest> <Errors> <Error> <Code>AWS.InvalidEnumeratedParameter</Code> <Message>The value you specified for SearchIndex is invalid. Valid values include [\t\t\t\t'All','Apparel','Appliances','ArtsAndCrafts','Automotive','Baby','Beauty','Blended','Books','Classical','Collectibles','DVD','DigitalMusic','Electronics','GiftCards','GourmetFood','Grocery','HealthPersonalCare','HomeGarden','Industrial','Jewelry','KindleStore','Kitchen','LawnAndGarden','Marketplace','MP3Downloads','Magazines',,'Miscellaneous','Music','MusicTracks','MusicalInstruments','MobileApps','OfficeProducts','OutdoorLiving','PCHardware','PetSupplies','Photo','Shoes','Software','SportingGoods','Tools','Toys','UnboxVideo','VHS','Video','VideoGames','Watches','Wireless','WirelessAccessories'\t\t\t\t].</Message> </Error> </Errors> </Request> </Items> </ItemSearchResponse>
【折腾过程】
1. 看起来,貌似SearchIndex不支持LawnGarden了。
而是变成了LawnAndGarden了。
2. 所以去试试
SearchIndex=LawnAndGarden
结果果然可以了:
<?xml version="1.0"?> <ItemSearchResponse> <OperationRequest> <HTTPHeaders> <Header Name="UserAgent" Value="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E"/> </HTTPHeaders> <RequestId>7330d7b0-4e9c-479d-854b-f744264ea915</RequestId> <Arguments> <Argument Name="Condition" Value="All"/> <Argument Name="Operation" Value="ItemSearch"/> <Argument Name="Service" Value="AWSECommerceService"/> <Argument Name="Signature" Value="uFmM1ZvRmDHjRDWKTDgQPZl3Z0ast3ZF8F+ylHRCw7U="/> <Argument Name="Availability" Value="Available"/> <Argument Name="ItemPage" Value="1"/> <Argument Name="AssociateTag" Value="xxx"/> <Argument Name="BrowseNode" Value="552808"/> <Argument Name="Version" Value="2011-08-01"/> <Argument Name="AWSAccessKeyId" Value="xxx"/> <Argument Name="Timestamp" Value="2013-06-16T15:43:13Z"/> <Argument Name="ResponseGroup" Value="ItemIds"/> <Argument Name="SearchIndex" Value="LawnAndGarden"/> </Arguments> <RequestProcessingTime>0.1007270000000000</RequestProcessingTime> </OperationRequest> <Items> <Request> <IsValid>True</IsValid> <ItemSearchRequest> <Availability>Available</Availability> <BrowseNode>552808</BrowseNode> <Condition>All</Condition> <ItemPage>1</ItemPage> <ResponseGroup>ItemIds</ResponseGroup> <SearchIndex>LawnAndGarden</SearchIndex> </ItemSearchRequest> </Request> <TotalResults>25223</TotalResults> <TotalPages>2523</TotalPages> <MoreSearchResultsUrl>http://www.amazon.com/gp/redirect.html?camp=2025&creative=386001&location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fsearch%3Fnode%3D552808%26url%3Dsearch-alias%253Dlawngarden&linkCode=xm2&tag=crifancom-20&SubscriptionId=AKIAJQAUAH2R4HCG63LQ</MoreSearchResultsUrl> <Item> <ASIN>B0045XRK06</ASIN> <ParentASIN>B005MRD2PG</ParentASIN> </Item> <Item> <ASIN>B004918MO2</ASIN> </Item> <Item> <ASIN>B005XVBIL6</ASIN> <ParentASIN>B005MRCI10</ParentASIN> </Item> <Item> <ASIN>B001RJOP5Y</ASIN> </Item> <Item> <ASIN>B0006JO0XI</ASIN> </Item> <Item> <ASIN>B0006JO0TC</ASIN> </Item> <Item> <ASIN>B0000VUNS8</ASIN> <ParentASIN>B00029XR8G</ParentASIN> </Item> <Item> <ASIN>B009Z6CW7O</ASIN> </Item> <Item> <ASIN>B00C62WJCM</ASIN> <ParentASIN>B00CILBJ9K</ParentASIN> </Item> <Item> <ASIN>B005NK7ZAA</ASIN> </Item> </Items> </ItemSearchResponse>
【总结】
Amazon的API的官网:
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/BrowseNodeIDs.html
很多内容是滞后的,所以,需要你自己亲自验证才可以。
比如此处的:
之前的叫做LawnGarden,现在改名为LawnAndGarden了。。。
转载请注明:在路上 » 【整理】AWS中的SearchIndex不再支持LawnGarden,已改名为LawnAndGarden