簡體   English   中英

Amazon Product API不遵守ResponseGroups

[英]Amazon Product API not respecting ResponseGroups

我正在嘗試使所有產品的價格都在12.50和11.50之間。 我正在使用Node-APAC來發送對Amazon Product API的請求。 這是我的請求代碼:

exports.search = function(req, res){

  OperationHelper = require('apac').OperationHelper;

  var opHelper = new OperationHelper({
      awsId: process.env.AMZ_ACCESS_KEY_CODE,
      awsSecret: process.env.AMZ_SECRET_ACCESS_KEY,
      assocId: process.env.AMZ_ASSOCIATE_ID
  });

  opHelper.execute('ItemSearch', {
      'SearchIndex': 'All',
      'Keywords': ' ',
      'MaximumPrice': 12.50,
      'MinimumPrice': 11.50,
      'ResponseGroup': 'Medium'
  }, function(error, results) {
     res.send(results);
  });
};

響應並不將結果限制為Medium ResponseGroup 您可以在此處看到一些完整的響應(非常大)。 結構如下:

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

它沒有返回文檔所說的應該包含在Medium ResponseGroup中的內容。 它返回了很多不必要的東西。 任何幫助表示贊賞!


注意:它還會退回不符合價格范圍的產品。 這些問題可能是相關的。 那里的任何提示都會有所幫助。

根據ItemSearch操作Amazon Product Advertising文檔 ,MinimumPrice(resp.MaximumPrice)“指定要退貨的商品的最低(最高)價格。價格以最低貨幣單位表示,例如,便士,例如,3241代表$ 32.41。”。

因此,如果您更改以下兩個參數的值:

'MaximumPrice': 12.50,
'MinimumPrice': 11.50,

'MaximumPrice': 1250,
'MinimumPrice': 1150,

價格過濾應該起作用。 至於ResponseGroup,我建議您傳遞“ Small,OfferSummary”(根據我對問題“如何指定Amazon Product API返回的信息”的回答)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM