question

Jonathan Ryan Grice avatar image
Jonathan Ryan Grice asked Jonathan Ryan Grice commented

Filter categories not equals

How do I list all items and filter out items found in categories that their name or id equals example?
I know the proper usage for listing all items is

/v3/merchants/%s/items

how can I filter out certain categories and still list remaining products?

such as

/v3/merchants/%s/items?filter=categories!%3Dshoes&filter=categories!%3Djewelry
REST APIsemi-integrationsSandboxInventory
4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jonathan Ryan Grice avatar image Jonathan Ryan Grice commented ·

Update: I've tried filtering using example

/v3/merchants/%s/items?filter=categories.name!=shoes

and

/v3/merchants/%s/items?filter=categories.id!=T70G4BMTFBF12

and also get 500 Internal Server Error

0 Likes 0 ·
Jonathan Ryan Grice avatar image Jonathan Ryan Grice commented ·
I still haven't sorted this issue out. I'm still receiving a "500 Internal Server Error" on filtering out items in certain categories either by categories.name or categories.id.

Any ideas would be greatly appreciated.
0 Likes 0 ·
zgreathouse avatar image zgreathouse Jonathan Ryan Grice commented ·

Are you still getting the 500 error?

Also we do have an endpoint to grab all the items of a single category.

GET /v3/merchants/{mId}/categories/{catId}/items
0 Likes 0 ·
Jonathan Ryan Grice avatar image Jonathan Ryan Grice commented ·
I am still getting to 500 Internet Server Error when trying to filter=category.name or filter= category.id. I'm paging from the items endpoint so it's not straining the server, but I want to filter out items from categories that can't be sold online.
0 Likes 0 ·

1 Answer

zgreathouse avatar image
zgreathouse Deactivated answered
The reason why you are getting a 500 error is because the categories themselves are nested in an array. (You cannot filter on nested items, you can only filter on top level fields in the JSON object)

What I would recommend is the following:

1. Create a separate category for "Available Online" (An item can belong to multiple categories)
2. Associate items available online to this category
3. Then you can use the "GET /v3/merchants/{mId}/categories/{catId}/items" endpoint to grab all the items available online.
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community