Amazon Product Advertising API:如何获取ItemLookup / Search的JSON响应 [英] Amazon Product Advertising API : How to get a JSON response for ItemLookup/Search
问题描述
我想从其ASIN中获取亚马逊产品的详细信息。产品API允许使用 ASIN
执行Itemlookup,但返回值位于 XML
中。
I'm trying to get the details of Amazon product from its ASIN. The product API allows to do a Itemlookup with ASIN
, but the return value is in XML
.
我想从客户端对Itemlookup执行此调用,因此想要进行 JSONP
调用我找不到。
I want to do this call for Itemlookup from client side, so would like to do a JSONP
call, which I couldn't find.
我在网上找到一些文章,使用XSLT样式表将XML转换为 JSON
格式:
I found some articles on the web to convert the XML to JSON
format using XSLT stylesheet:
(a) https://bitbucket.org/basti/python-amazon-product-api/src/tip/examples/json-results.py
我试过使用这个 python-amazon-product-api
和这个例子,但我不能得到 JSON
返回。
I tried using this python-amazon-product-api
and this example, but I couldn't get a JSON
return.
(b) http://www.kokogiak.com/gedankengang/2006/05/consuming-amazons-web-api-directly.html
请求我尝试发送的是:
http://xml-us.amznxslt.com/onca/xml?AWSAccessKeyId=[ACCESS KEY]&AssociateTag=[ASSOCIATE TAG]&ContentType=text%2Fjavascript&IdType=ASIN&ItemId=B008IEGS9W&Operation=ItemLookup&ResponseGroup=Images%2CItemAttributes&Service=AWSECommerceService&Style=http%3A%2F%2Fforums.delphiforums.com%2Fdelphidocsz%2Famazon%2Fjson.xsl&Timestamp=2012-09-04T06%3A40%3A11Z&Signature=AGOqXvVSeMp3YyVkT4mGNXVx0cFGG%2Bh%2FdAebevbbF9o%3D
请使用 Amazon产品API
帮助获取JSON格式。欢迎任何建议。
Please help with getting a JSON format with Amazon product API
. Any suggestions are welcome.
OP可以运行此样式表(未使用输入文档)来确定其XSLT版本。
The OP can run this style-sheet (input document not used) to determine his XSLT version.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="xsl msxsl">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<head><title>About your XSLT Processor</title></head>
<body>
<ul>
<li>xsl:version=<xsl:value-of select="system-property('xsl:version')" /></li>
<li>xsl:vendor=<xsl:value-of select="system-property('xsl:vendor')" /></li>
<li>xsl:vendor-url=<xsl:value-of select="system-property('xsl:vendor-url')" /></li>
<li>xsl:product-name=<xsl:value-of select="system-property('xsl:product-name')" /></li>
<li>xsl:product-version=<xsl:value-of select="system-property('xsl:product-version')" /></li>
<li>xsl:is-schema-aware=<xsl:value-of select="system-property('xsl:is-schema-aware')" /></li>
<li>xsl:supports-serialization=<xsl:value-of select="system-property('xsl:supports-serialization')" /></li>
<li>xsl:supports-backwards-compatibility=<xsl:value-of select="system-property('xsl:supports-backwards-compatibility')" /></li>
<li>msxsl:version=<xsl:value-of select="system-property('msxsl:version')" /></li>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
推荐答案
请尝试以下方法之一:
- 亚马逊JSON API
- 尝试以下任何Javascript函数将您已经拥有的XML转换为JSON:
- Amazon JSON API - This is a ruby webservice to pass through requests and translate the responses to JSON.
- Try any of these Javascript functions to convert the XML you already have into JSON :
- http://goessner.net/download/prj/jsonxml/
- http://davidwalsh.name/convert-xml -json
- http:/ /www.fyneworks.com/jquery/xml-to-json/
- http://www.thomasfrank.se/xml_to_json.html
- http://goessner.net/download/prj/jsonxml/
- http://davidwalsh.name/convert-xml-json
- http://www.fyneworks.com/jquery/xml-to-json/
- http://www.thomasfrank.se/xml_to_json.html
我自己试过thomasfrank。它容易和工作很好:)
I've tried thomasfrank myself. Its easy and works well :)
这篇关于Amazon Product Advertising API:如何获取ItemLookup / Search的JSON响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!