我一直在为Django应用程序使用Walmart Search API,我希望只搜索沃尔玛官方产品数据,而不是Walmart市场。我一直在尝试使用构面过滤器将返回的json响应限制为仅具有marketplace = false但没有成功的项目。
方面响应选项为: Pickup_and_delivery,品牌,价格和零售商(有关标准“ ipod”查询的响应,请参见facets_list.txt):
"facets": [{
"name": "pickup_and_delivery",
"properties": {
"multi": "or",
"nullCount": "0"
},
"displayName": "Shipping & Pickup",
"facetValues": [{
"name": "2-Day Shipping",
"count": 141
}, {
"name": "Ship to Home",
"count": 260
}, {
"name": "FREE Pickup",
"count": 10
}]
}, {
"name": "brand",
"properties": {
"multi": "or",
"nullCount": "4"
},
"displayName": "Brand",
"facetValues": [{
"name": "Apple",
"count": 158
}, {
"name": "Jensen",
"count": 2
}, {
"name": "Insten",
"count": 20
}, {
"name": "RAM Game Room",
"count": 8
}, {
"name": "Home Comforts",
"count": 4
}, {
"name": "Unbranded",
"count": 4
}, {
"name": "Colordrives",
"count": 3
}, {
"name": "EpicDealz",
"count": 3
}, {
"name": "Group Vertical",
"count": 3
}, {
"name": "AGPTEK",
"count": 2
}, {
"name": "AGPtek",
"count": 2
}, {
"name": "CELLET",
"count": 2
}, {
"name": "DLO - Phillips",
"count": 2
}, {
"name": "MyNetDeals",
"count": 2
}, {
"name": "SuperGuardZ",
"count": 2
}, {
"name": "ULAK",
"count": 2
}, {
"name": "USA Gear",
"count": 2
}, {
"name": "XtremeMac",
"count": 2
}, {
"name": "jWIN",
"count": 2
}, {
"name": "APPLE IPODS AND APPLE TV",
"count": 1
}]
}, {
"name": "price",
"properties": {
"multi": "or",
"nullCount": "0"
},
"displayName": "Price",
"facetValues": [{
"name": "$0 - $75"
}, {
"name": "$75 - $100"
}, {
"name": "$100 - $150"
}, {
"name": "$150 - $200"
}, {
"name": "$200 - $250"
}, {
"name": "$250+"
}]
}, {
"name": "retailer",
"properties": {
"multi": "or",
"nullCount": "1"
},
"displayName": "Retailer",
"facetValues": [{
"name": "Walmart.com",
"count": 9
}, {
"name": "VIPOUTLET",
"count": 2
}, {
"name": "Altatac",
"count": 2
}, {
"name": "Simple Cell Inc",
"count": 6
}, {
"name": "The iSuperStore",
"count": 123
}, {
"name": "eForCity",
"count": 21
}, {
"name": "Landloop Corporation",
"count": 8
}, {
"name": "HOME COMFORTS",
"count": 5
}, {
"name": "LUCKYSTARTECHNOLOGYINC",
"count": 5
}, {
"name": "Concept Electronics",
"count": 4
}, {
"name": "EpicDealz",
"count": 4
}, {
"name": "Lindmeyers",
"count": 4
}, {
"name": "Quality Photo",
"count": 4
}, {
"name": "Wombat Reserve",
"count": 4
}, {
"name": "Group Vertical",
"count": 3
}, {
"name": "Tetchy Tech",
"count": 3
}, {
"name": "2ndstreet Electronics",
"count": 2
}, {
"name": "Clover Hill",
"count": 2
}, {
"name": "DealClock",
"count": 2
}, {
"name": "Direct Deals",
"count": 2
}]
}]
}
我将构面过滤器设置为“ retailer:Walmart.com”,但仍允许在搜索中返回市场商品。这是简化到返回的第一项以及一些关键值的响应:
{
"query": "ipod",
"sort": "relevance",
"responseGroup": "base",
"totalResults": 260,
"start": 1,
"numItems": 10,
"items": [{
"itemId": 42608125,
"parentItemId": 42608125,
"name": "Apple iPod touch 32GB",
"msrp": 247.0,
"salePrice": 249.0,
"upc": "888462353151",
"categoryPath": "",
"shortDescription": "",
"longDescription": "",
"thumbnailImage": "",
"mediumImage": "",
"largeImage": "",
"productTrackingUrl": "",
"standardShipRate": 0.0,
"marketplace": true,
"modelNumber": "MKJ02LL/A",
"sellerInfo": "ElectroCell",
"productUrl": "",
"customerRating": "4.517",
"numReviews": 209,
"customerRatingImage": "",
"categoryNode": "",
"rhid": "32367",
"bundle": false,
"stock": "Available",
"addToCartUrl": "",
"affiliateAddToCartUrl": "",
"freeShippingOver35Dollars": false,
"giftOptions": {},
"imageEntities": [{
"thumbnailImage": "",
"mediumImage": "",
"largeImage": "",
"entityType": ""
}
http://api.walmartlabs.com/v1/search?query=ipod&format=json&facet=on&facet.filter=retailer:Walmart.com&apiKey= {apikeyhere}
为简单起见,我使用Interactive API Tool生成了此请求:https://developer.walmartlabs.com/io-docs
我也尝试使用项目响应组(https://developer.walmartlabs.com/docs/read/Item_Field_Description) 限制搜索,但是我不确定如何正确地组织这种类型的查询。我最终将查询格式化为: http://api.walmartlabs.com/v1/search?query=ipod&format=json&facet=on&facet.filter=marketplace:False&apiKey= {apikeyhere} 构面过滤器用作“ marketplace:False”。
我尝试使用“排序”来尝试更改“项目响应组”,但这也不起作用。 “ responseGroup”查询参数仅显示为允许两个可能的输入:基本,完整。这些仅更改搜索中返回的信息量。
我不太确定如何从此处开始,因为Search API的文档非常有限,因此非常感谢任何指导。 https://developer.walmartlabs.com/docs/read/Search_API
预期结果是通过使用方面过滤仅返回“ Walmart.com”零售商。
---- EDIT ---
我仔细查看了在构面过滤器中用作零售商的“ Walmart.com”获得的查询结果,我注意到一切正常。使我感到困惑的问题是,查询结果仍在返回一个市场:似乎是第三方供应商的“真”值。
但是,当我比较启用和不启用Facet筛选器的查询结果时,您可以看到市场:几乎每个值都返回false(我将查询结果简化为以下几个值):< / p>
Query=ipod (9 results) Query=ipod (10 results)
Facet=on&facet.filter=retailer:Walmart.com Facet=off
"marketplace": true, "marketplace": true,
"modelNumber": "MKJ02LL/A", "modelNumber": "MKJ02LL/A",
"sellerInfo": "ElectroCell", "sellerInfo": "ElectroCell",
"marketplace": false, "marketplace": false,
"modelNumber": "MKWM2LL/A", "modelNumber": "MKWM2LL/A",
"marketplace": false, "marketplace": true,
"modelNumber": "MKHJ2LL/A", "sellerInfo": "Quality Photo",
"marketplace": false, "marketplace": false,
"modelNumber": "AMZ94926", "modelNumber": "MKJ02LL/A",
"marketplace": false, "marketplace": true,
"modelNumber": "ID7HXS-F00", "modelNumber": "MKN22LLA_NEW90",
"sellerInfo": "The iSuperStore",
"marketplace": false, "marketplace": true
"modelNumber": "IPOD5CBPCH", "modelNumber": "MKN52LL/A","marketplace": true,
"sellerInfo": "The iSuperStore",
"marketplace": false, "marketplace": false,
"modelNumber": "GM-iLOOP", "modelNumber": "MKMJ2LL/A",
"marketplace": false, "marketplace": true,
"modelNumber": "RBMD481LL/A", "modelNumber": "MKN52LL/A",
"sellerInfo": "The iSuperStore",
"marketplace": false, "marketplace": true,
"modelNumber": "MC027LL/A", "sellerInfo": "Concept Electronics",
"marketplace": true,
"modelNumber": "VIPRB-MKJ02LL/A",
"sellerInfo": "VIPOUTLET",
我不知道为什么Electrocell供应商仍被归类为“ Walmart.com”作为零售商,但看来这仍然是使用Search API减少第三方查询结果的有效方法。
如果有人能够更有效地执行此搜索,以便现在返回第三方结果(例如使用responseGroup),请告诉我。