How to exclude grocery products when filtering Walmart API search results by category?

163 Views Asked by At

I would like to create a query string to filter products by multiple categories, since I would like to have groceries separate from any other product categories.

I haven't found anything related to this topic on the walmart.io docs.

So far I have tried to do this to get non-grocery products but the results still include groceries:

 const normalCategoryIds = [ '4044', '2637', '3944',
        '4125','5440','5431','14503',
        '5426','5438','5433','1005862',
        '1085632','976759','5920738','8932632',
        '3734780','9748312','3625709','2636',
        '5428','976760','7796869','1085666',
        '1094765','1105910','6735581','5967908',
        '5939293','6914230','4191733','2593086',
        '6957270','1229749','91083','3891',
        '4096','4104','4171','3920',
        '1072864','1334134','5427','5434',
        '5436','6163033','6197502','7924299',
        '5324366','5984018','8834205',
    ];

...

axios.get(`https://developer.api.walmart.com/api-proxy/service/affil/product/v2/search?query=apple${normalCategoryIds.map(catid => `&facet.filter=categoryId:${catid}`)}`, {
        headers: walmart.generateHeaders()
    })

also this:

 axios.get(`https://developer.api.walmart.com/api-proxy/service/affil/product/v2/search?query=apple${normalCategoryIds.map(catid => `&categoryId=${catid}`)}`, {
        headers: walmart.generateHeaders()
    })
0

There are 0 best solutions below