亚马逊产品广告 API v5 - 如何通过一次 API 调用检索不同类型的书籍(硬拷贝、平装本、kindle...)

wpr*_*gLK 5 amazon-web-services amazon-advertising-api paapi

我\xe2\x80\x99是一家公司的开发人员,我们多年来一直使用亚马逊出色的产品广告 API (PA-API) 来获取图书信息。我们\xe2\x80\x99当前使用Java SDK和API v5。

\n

问题

\n

我们为客户提供与我们附属公司的直接链接,以获取不同亚马逊商店上的相关硬拷贝或电子书。为此,我们创建一个以 ISBN(例如 9780399562396)为关键字且没有特定搜索索引的SearchItems 文档请求。过去,我们收到的回复包含两个商品,因此有两个 ASIN,一个用于硬拷贝,一个用于电子书(可通过 itemInfo\xe2\x80\x99s 产品组进行区分)。然而,一段时间以来,我们不得不认识到响应通常只包含一项,即硬拷贝产品。

\n

我已经使用很棒的Scratchpad尝试了不同的方法。

\n

问题

\n

有趣的是,当我明确包含搜索索引(更多信息请参见此处) \xe2\x80\x9cBooks\xe2\x80\x9d 或 \xe2\x80\x9cKindleStore\xe2\x80\x9d 时,API 正在响应预期的项目(对于带有书籍的“书籍”和对于带有 Kindle 的“KindleStore”)。我们通过查看ItemInfo.Classifications(更多信息在这里)来做到这一点但是,如果我在索引 \xe2\x80\x9cAll\xe2\x80\x9d 或 don\xe2\x80\x99t 指定它时搜索,它只返回一项(通常是硬拷贝)。在我看来这很奇怪\xe2\x80\xa6 API/搜索索引是否应该像这样表现?

\n

此外,我无法弄清楚如何在同一请求中搜索索引,在我看来,这根本不受支持,但我希望至少会返回两个项目\xe2\x80\xa6

\n

因此,我想问您是否有人可以解释一下,我们可以通过一个请求检索同一 ISBN 的两个 ASIN(kindle + 硬拷贝书)。当然,可以为每个产品组创建两个单独的请求,但是由于 API 费率与发货商品收入相关,因此我们希望避免不必要的 API 请求。

\n

使用和不使用搜索索引的显式用法的一些示例

\n

在下面的示例中,我通过执行 SearchItem 请求来查找 ISBN 9780262043649 的书籍的硬拷贝或 kindle。

\n

a) 具有给定搜索索引的硬拷贝

\n

有效载荷

\n
{\n "Keywords": "9780262043649",\n "Resources": [\n  "ItemInfo.Classifications",\n  "ItemInfo.Title"\n ],\n "SearchIndex": "Books",\n "PartnerTag": "*********",\n "PartnerType": "Associates",\n "Marketplace": "www.amazon.com",\n "Operation": "SearchItems"\n}\n
Run Code Online (Sandbox Code Playgroud)\n

回复

\n
{\n "SearchResult": {\n  "Items": [\n   {\n    "ASIN": "0262043645",\n    "DetailPageURL": "https://www.amazon.com/dp/0262043645?tag=getabstractcom&linkCode=osi&th=1&psc=1",\n    "ItemInfo": {\n     "Classifications": {\n      "Binding": {\n       "DisplayValue": "Hardcover",\n       "Label": "Binding",\n       "Locale": "en_US"\n      },\n      "ProductGroup": {\n       "DisplayValue": "Book",\n       "Label": "ProductGroup",\n       "Locale": "en_US"\n      }\n     },\n     "Title": {\n      "DisplayValue": "Novacene: The Coming Age of Hyperintelligence (The MIT Press)",\n      "Label": "Title",\n      "Locale": "en_US"\n     }\n    }\n   }\n  ],\n  "SearchURL": "https://www.amazon.com/s?k=9780262043649&i=stripbooks&rh=p_n_availability%3A-1&tag=getabstractcom&linkCode=osi",\n  "TotalResultCount": 1\n }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

b) Kindle 具有给定的搜索索引

\n

有效载荷

\n
{\n "Keywords": "9780262043649",\n "Resources": [\n  "ItemInfo.Classifications",\n  "ItemInfo.Title"\n ],\n "SearchIndex": "KindleStore",\n "PartnerTag": "******",\n "PartnerType": "Associates",\n "Marketplace": "www.amazon.com",\n "Operation": "SearchItems"\n}\n
Run Code Online (Sandbox Code Playgroud)\n

回复

\n
{\n "SearchResult": {\n  "Items": [\n   {\n    "ASIN": "B08BT4MM18",\n    "DetailPageURL": "https://www.amazon.com/dp/B08BT4MM18?tag=getabstractcom&linkCode=osi&th=1&psc=1",\n    "ItemInfo": {\n     "Classifications": {\n      "Binding": {\n       "DisplayValue": "Kindle Edition",\n       "Label": "Binding",\n       "Locale": "en_US"\n      },\n      "ProductGroup": {\n       "DisplayValue": "Digital Ebook Purchas",\n       "Label": "ProductGroup",\n       "Locale": "en_US"\n      }\n     },\n     "Title": {\n      "DisplayValue": "Novacene: The Coming Age of Hyperintelligence",\n      "Label": "Title",\n      "Locale": "en_US"\n     }\n    }\n   }\n  ],\n  "SearchURL": "https://www.amazon.com/s?k=9780262043649&i=digital-text&rh=p_n_availability%3A-1&tag=getabstractcom&linkCode=osi",\n  "TotalResultCount": 1\n }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

c) 没有特定的搜索索引

\n

有效载荷

\n
{\n "Keywords": "9780262043649",\n "Resources": [\n  "ItemInfo.Classifications",\n  "ItemInfo.Title"\n ],\n "PartnerTag": "*******",\n "PartnerType": "Associates",\n "Marketplace": "www.amazon.com",\n "Operation": "SearchItems"\n}\n
Run Code Online (Sandbox Code Playgroud)\n

回复

\n
{\n "SearchResult": {\n  "Items": [\n   {\n    "ASIN": "B08BT4MM18",\n    "DetailPageURL": "https://www.amazon.com/dp/B08BT4MM18?tag=getabstractcom&linkCode=osi&th=1&psc=1",\n    "ItemInfo": {\n     "Classifications": {\n      "Binding": {\n       "DisplayValue": "Kindle Edition",\n       "Label": "Binding",\n       "Locale": "en_US"\n      },\n      "ProductGroup": {\n       "DisplayValue": "Digital Ebook Purchas",\n       "Label": "ProductGroup",\n       "Locale": "en_US"\n      }\n     },\n     "Title": {\n      "DisplayValue": "Novacene: The Coming Age of Hyperintelligence",\n      "Label": "Title",\n      "Locale": "en_US"\n     }\n    }\n   }\n  ],\n  "SearchURL": "https://www.amazon.com/s?k=9780262043649&rh=p_n_availability%3A-1&tag=getabstractcom&linkCode=osi",\n  "TotalResultCount": 1\n }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

研究/更多信息

\n\n