2

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

问题

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

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

问题

有趣的是,当我明确包含搜索索引(更多信息在这里)“Books”或“KindleStore”时,API 会响应预期的项目(对于“books”来说是一本书,对于“KindleStore”来说是一个 kindle)。我们通过查看ItemInfo.Classifications(更多信息here)来做到这一点。但是,如果我在索引“All”中搜索或未指定它,它只会返回一项(通常是硬拷贝)。在我看来这很奇怪...... API/搜索索引是否应该表现得像这样?

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

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

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

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

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

有效载荷

{
 "Keywords": "9780262043649",
 "Resources": [
  "ItemInfo.Classifications",
  "ItemInfo.Title"
 ],
 "SearchIndex": "Books",
 "PartnerTag": "*********",
 "PartnerType": "Associates",
 "Marketplace": "www.amazon.com",
 "Operation": "SearchItems"
}

回复

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

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

有效载荷

{
 "Keywords": "9780262043649",
 "Resources": [
  "ItemInfo.Classifications",
  "ItemInfo.Title"
 ],
 "SearchIndex": "KindleStore",
 "PartnerTag": "******",
 "PartnerType": "Associates",
 "Marketplace": "www.amazon.com",
 "Operation": "SearchItems"
}

回复

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

c) 没有特定的搜索索引

有效载荷

{
 "Keywords": "9780262043649",
 "Resources": [
  "ItemInfo.Classifications",
  "ItemInfo.Title"
 ],
 "PartnerTag": "*******",
 "PartnerType": "Associates",
 "Marketplace": "www.amazon.com",
 "Operation": "SearchItems"
}

回复

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

研究/更多信息

非常感谢您的任何建议。

4

0 回答 0