【问题标题】:How to specify what Amazon Product API returns如何指定亚马逊产品 API 返回的内容
【发布时间】:2013-03-13 21:55:26
【问题描述】:

我需要快速的应用程序,因此我想在响应中准确指定我想要的内容,而不是在其中包含大量多余的信息。我知道ResponseGroups,但没有一个组可以限制我返回的信息。如果您查看my current implementation,它会发回大量与我正在寻找的产品无关的信息。真正的问题是它只是笨重。

有没有办法为每个产品指定非常具体的内容?例如:

  • 格式化价格
  • 姓名
  • 链接
  • 图片
  • 说明

我什么都不在乎。

注意:我使用Node-APAC 来处理对亚马逊产品API 的请求。所以它为我将响应 XML 转换为 JSON。

这是我得到的(大部分):

{
    ItemSearchResponse: {
        $: {...},
        OperationRequest: [...],
        Items: [
            {
                Request: [...],
                TotalResults: [...],
                TotalPages: [...],
                MoreSearchResultsUrl: [...],
                Item: [
                    {
                        ASIN: [...],
                        DetailPageURL: [...],
                        ItemLinks: [...],
                        SmallImage: [...],
                        MediumImage: [...],
                        LargeImage: [...],
                        ImageSets: [...],
                        ItemAttributes: [...],
                        OfferSummary: [...]
                    },
                    {...},
                    {...},
                    {...},
                    {...}
                ]
            }
        ]
    }
}

我想得到的是:

[
  {
    FormattedPrice: 12.99,
    Name: "The Hitchhiker's Guide to the Galaxy"
    Link: "http://www.amazon.com/Hitchhikers-Guide-Galaxy-Douglas-Adams/dp/0345391802"
    Image: "http://g-ecx.images-amazon.com/images/G/01/ciu/eb/05/0663124128a0de9c79891010.L._AA300_.jpg"
    Description: "<Book-Description>"
  },
  {...},
  {...}
]

【问题讨论】:

    标签: api node.js amazon-web-services amazon amazon-product-api


    【解决方案1】:

    我认为没有办法准确指定您想要的内容。您必须通过 ReponseGroup。在您的情况下,我建议您为 ResponseGroup 值传递“Small,OfferSummary”。它应该返回您需要的内容,同时保持响应大小合理。

    【讨论】:

      猜你喜欢
      • 2017-08-11
      • 1970-01-01
      • 2018-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多