4

我正在尝试查询搜索 API,并在 url 中设置 responseGroup=base 以限制响应中的项目,但它仍然向我发送所有 31 个项目属性(相对于基组中的 12 个),这消耗了 4 倍的带宽和我需要的记忆。

这是我的查询示例:

https://api.walmartlabs.com/v1/search?apiKey=[myapikey]&numItems=1&start=1&query=apple%20watch%20screen%20protector&responseGroup=base

和回应:

{
  "query": "apple watch screen protector",
  "sort": "relevance",
  "responseGroup": "base",
  "totalResults": 707,
  "start": 1,
  "numItems": 1,
  "items": [{
    "itemId": 469667798,
    "parentItemId": 469667798,
    "name": "RinoGear [6-PACK] Apple Watch 38mm (Series 1, 2, 3) Screen Protector [Active Protection] Sport Flexible HD Crystal Clear Anti-Bubble Film",
    "msrp": 6.95,
    "salePrice": 4.95,
    "upc": "712038084487",
    "categoryPath": "Jewelry/Watches/Mens Watches/Mens Smart Watches",
    "shortDescription": "RinoGear is the internet's leading manufacturer of screen protection products for active and daily use. Are you tired of screen protectors that: 1. Get scratched easily? 2. Only give you one chance to install it in position?3. Distort the images on your screen?4. Simply do not provide adequate protection? INTRODUCING: RinoGear -- The Original Active Screen Protectors * Active Protection - Designed for active use, highly flexible, damage protection.* Military-Grade Material - Virtually indestructible film used by the military to protect aircraft surfaces.* Invisible Ultra Clear - Advanced optical material is used to ensure you get the highest visibility on your screen.* Easy Application - Installation is done by "wet application" which allows you to re-position the film as many times on the surface unlike typical screen protectors.* Bubble Free and Anti-Yellowing - Advanced polymer adhesive is used to prevent the forming of air bubbles and discoloration.* No Sticky Residue - Film from your screen leaves no sticky residue.Why Use A Screen Protector? ALL Screens Get Damaged:Despite the grade of glass, screens still scratch or get damaged. Even so-called unscratchable glass still get scratched. Our tests have proven that no type of screen is invulnerable from damage Damage Comes From Anywhere / Anytime:New tech devices such as smartwatches or phones are expensive. Even placing it in a pocket or purse can ruin it. Don’t risk damaging your tech by not protecting it. Why Use RinoGear SHIELD? Tested Under Harsh Active Conditions:Our screen protectors are put to harsh and extreme conditions by runners, hikers, cyclists, and the like. It can most definitely handle regular wear & tear even if you’re not active.What's Included? * RinoGear film* Microfiber cleaning cloth* Installation assist card* Detailed instructions",
    "longDescription": "THE ORIGINAL active screen protector for Apple Watch 38mm - designed for active use, precision laser cut for perfect fitment; made with unique flexible "smart skin" material",
    "thumbnailImage": "https://i5.walmartimages.com/asr/aa328cfa-a315-4d39-ab35-1ce106981d23_1.74cba72df03d8c16ba7ffe44856da654.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF",
    "mediumImage": "https://i5.walmartimages.com/asr/aa328cfa-a315-4d39-ab35-1ce106981d23_1.74cba72df03d8c16ba7ffe44856da654.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
    "largeImage": "https://i5.walmartimages.com/asr/aa328cfa-a315-4d39-ab35-1ce106981d23_1.74cba72df03d8c16ba7ffe44856da654.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF",
    "productTrackingUrl": "http://linksynergy.walmart.com/fs-bin/click?id=|LSNID|&offerid=223073.7200&type=14&catid=8&subid=0&hid=7200&tmpid=1082&RD_PARM1=https%253A%252F%252Fwww.walmart.com%252Fip%252FRinoGear-6-PACK-Apple-Watch-38mm-Series-1-2-3-Screen-Protector-Active-Protection-Sport-Flexible-HD-Crystal-Clear-Anti-Bubble-Film%252F469667798%253Faffp1%253DkGhYtF3qwzvpUaAP8p5ePeswUiHqBuEtoaWj4POSEkc%2526affilsrc%253Dapi",
    "standardShipRate": 0,
    "marketplace": true,
    "sellerInfo": "TBE Fulfillment",
    "productUrl": "http://c.affil.walmart.com/t/api02?l=https%3A%2F%2Fwww.walmart.com%2Fip%2FRinoGear-6-PACK-Apple-Watch-38mm-Series-1-2-3-Screen-Protector-Active-Protection-Sport-Flexible-HD-Crystal-Clear-Anti-Bubble-Film%2F469667798%3Faffp1%3DkGhYtF3qwzvpUaAP8p5ePeswUiHqBuEtoaWj4POSEkc%26affilsrc%3Dapi%26veh%3Daff%26wmlspartner%3Dreadonlyapi",
    "customerRating": "4.333",
    "numReviews": 2,
    "customerRatingImage": "http://i2.walmartimages.com/i/CustRating/4_3.gif",
    "categoryNode": "3891_3906_1490361",
    "rhid": "32332",
    "bundle": false,
    "stock": "Available",
    "addToCartUrl": "http://c.affil.walmart.com/t/api02?l=http%3A%2F%2Faffil.walmart.com%2Fcart%2FaddToCart%3Fitems%3D469667798%7C1%26affp1%3DkGhYtF3qwzvpUaAP8p5ePeswUiHqBuEtoaWj4POSEkc%26affilsrc%3Dapi%26veh%3Daff%26wmlspartner%3Dreadonlyapi",
    "affiliateAddToCartUrl": "http://linksynergy.walmart.com/fs-bin/click?id=|LSNID|&offerid=223073.7200&type=14&catid=8&subid=0&hid=7200&tmpid=1082&RD_PARM1=http%253A%252F%252Faffil.walmart.com%252Fcart%252FaddToCart%253Fitems%253D469667798%257C1%2526affp1%253DkGhYtF3qwzvpUaAP8p5ePeswUiHqBuEtoaWj4POSEkc%2526affilsrc%253Dapi",
    "freeShippingOver35Dollars": false,
    "giftOptions": {},
    "imageEntities": [{
        "thumbnailImage": "https://i5.walmartimages.com/asr/d34ed9de-b16d-4d4b-bf01-2e0037220859_1.89304402d998330766cc88ffc6f105af.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF",
        "mediumImage": "https://i5.walmartimages.com/asr/d34ed9de-b16d-4d4b-bf01-2e0037220859_1.89304402d998330766cc88ffc6f105af.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
        "largeImage": "https://i5.walmartimages.com/asr/d34ed9de-b16d-4d4b-bf01-2e0037220859_1.89304402d998330766cc88ffc6f105af.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF",
        "entityType": "SECONDARY"
      },
      {
        "thumbnailImage": "https://i5.walmartimages.com/asr/ca2f25a1-b2b9-48ac-aa07-caaf81a2a888_1.f5692dd141c31331e89b74f4dfbe78bc.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF",
        "mediumImage": "https://i5.walmartimages.com/asr/ca2f25a1-b2b9-48ac-aa07-caaf81a2a888_1.f5692dd141c31331e89b74f4dfbe78bc.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
        "largeImage": "https://i5.walmartimages.com/asr/ca2f25a1-b2b9-48ac-aa07-caaf81a2a888_1.f5692dd141c31331e89b74f4dfbe78bc.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF",
        "entityType": "SECONDARY"
      },
      {
        "thumbnailImage": "https://i5.walmartimages.com/asr/91995a72-4490-4209-9c0a-5f39781d4e6b_1.4ccae1cbbfc7c8f2e7ceb89170cd3687.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF",
        "mediumImage": "https://i5.walmartimages.com/asr/91995a72-4490-4209-9c0a-5f39781d4e6b_1.4ccae1cbbfc7c8f2e7ceb89170cd3687.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
        "largeImage": "https://i5.walmartimages.com/asr/91995a72-4490-4209-9c0a-5f39781d4e6b_1.4ccae1cbbfc7c8f2e7ceb89170cd3687.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF",
        "entityType": "SECONDARY"
      },
      {
        "thumbnailImage": "https://i5.walmartimages.com/asr/181c8dce-312f-4b40-83b5-5e34c9b832a5_1.0b5589b7a9cbeb0a293c7bb51fed9b69.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF",
        "mediumImage": "https://i5.walmartimages.com/asr/181c8dce-312f-4b40-83b5-5e34c9b832a5_1.0b5589b7a9cbeb0a293c7bb51fed9b69.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
        "largeImage": "https://i5.walmartimages.com/asr/181c8dce-312f-4b40-83b5-5e34c9b832a5_1.0b5589b7a9cbeb0a293c7bb51fed9b69.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF",
        "entityType": "SECONDARY"
      },
      {
        "thumbnailImage": "https://i5.walmartimages.com/asr/4cc53f1e-ad60-4b53-98dc-1d794cd096f9_1.7834b744d625fde3f56830c11de9eb99.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF",
        "mediumImage": "https://i5.walmartimages.com/asr/4cc53f1e-ad60-4b53-98dc-1d794cd096f9_1.7834b744d625fde3f56830c11de9eb99.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
        "largeImage": "https://i5.walmartimages.com/asr/4cc53f1e-ad60-4b53-98dc-1d794cd096f9_1.7834b744d625fde3f56830c11de9eb99.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF",
        "entityType": "SECONDARY"
      },
      {
        "thumbnailImage": "https://i5.walmartimages.com/asr/e1582526-6f8d-4942-833c-a3cbfd56e0e5_1.660e5fdba3e0502f8730b17e75e363ff.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF",
        "mediumImage": "https://i5.walmartimages.com/asr/e1582526-6f8d-4942-833c-a3cbfd56e0e5_1.660e5fdba3e0502f8730b17e75e363ff.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
        "largeImage": "https://i5.walmartimages.com/asr/e1582526-6f8d-4942-833c-a3cbfd56e0e5_1.660e5fdba3e0502f8730b17e75e363ff.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF",
        "entityType": "SECONDARY"
      },
      {
        "thumbnailImage": "https://i5.walmartimages.com/asr/aa328cfa-a315-4d39-ab35-1ce106981d23_1.74cba72df03d8c16ba7ffe44856da654.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF",
        "mediumImage": "https://i5.walmartimages.com/asr/aa328cfa-a315-4d39-ab35-1ce106981d23_1.74cba72df03d8c16ba7ffe44856da654.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
        "largeImage": "https://i5.walmartimages.com/asr/aa328cfa-a315-4d39-ab35-1ce106981d23_1.74cba72df03d8c16ba7ffe44856da654.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF",
        "entityType": "PRIMARY"
      }
    ],
    "offerType": "ONLINE_ONLY",
    "availableOnline": true
  }],
  "facets": []
}

基础 responseGroup 中应该只有 12 个属性,但有 31 个。

4

1 回答 1

1

似乎 API 确实尊重 responseGroup 参数,因为响应在 full 和 base 之间确实略有不同,API 响应本身也表明它是 base 类型还是 full 类型。

看起来文档已经过时了,这种情况到处都发生。format=xml例如,即使已尽可能说明,也无法请求。您在完整响应中获得的唯一不同键似乎是brandName, clearance, preOrder, attributes.

然而,他们确实声明该 API 仍处于测试阶段,所以我认为他们正在积极开发它,而没有更新文档。

于 2018-12-21T04:39:50.497 回答