从亚马逊产品Api的url xml中获取垂直数据

本文关键字:xml 获取 垂直 数据 url 亚马逊 Api | 更新日期: 2023-09-27 18:11:39

我是新来的asp.net和亚马逊产品广告API查找........我想从API中获取产品的价格。他们已经为我生成了URL,这个URL正在生成包含产品细节的XML。我只想从"amount"节点获取金额。我试了很多天,但做不到。有人能帮我吗?谢谢你。

从亚马逊产品Api的url xml中获取垂直数据

REST way

从https://aws.amazon.com/code/Product-Advertising-API/2480下载文件(AmazonProductAdvtApiSampleCSharpQuery'Sample'src)并复制SignedRequestHelper.cs

 SignedRequestHelper helper = new SignedRequestHelper("XXXXXXXXXX", "XXXXXXXXXXXXXXXXXXX", "webservices.amazon.com");
 IDictionary < string, string > dictValue = new Dictionary < string, String > ();
 dictValue["Service"] = "AWSECommerceService";
 dictValue["Version"] = "2011-08-01";
 dictValue["Operation"] = "ItemLookup";
 dictValue["ItemId"] = asinCode;
 dictValue["IdType"] = "ASIN";
 dictValue["AssociateTag"] = "xxxxxxxxx-xx";
 dictValue["ResponseGroup"] = "ItemAttributes";
 string url = helper.Sign(dictValue)
 WebRequest request = WebRequest.Create(url);
 string price;
 using(WebResponse response = await request.GetResponseAsync()) {
    if (response != null) {
        using(XmlReader reader = XmlReader.Create(response.GetResponseStream())) {
            // Now parse XML  accordingly
            reader.ReadToFollowing("ListPrice")
            if (reader.ReadToDescendant("FormattedPrice")) {
                price = reader.ReadElementContentAsString();