question

Mike-Patchworks avatar image
Mike-Patchworks asked ·

Retrieving item <-> option association via API

I'm trying to pull configurable/matrix items from a Clover station via the API.
I can get the item groups (lets say TSHIRT) I can then get the attributes associated with that group (lets say SIZE) I can then get the options associated with that attribute (lets say SMALL, MEDIUM) What I can't seem to do (or can't find reference in the v3 API docs is get an item out of the API, and match it specifically to the option.
I can get ITEM1 out, which says it is part of TSHIRT GROUP, so I know ITEM1 is TSHIRT GROUP, configured on SIZE and is either SMALL or MEDIUM, but nothing gives me the definite "ITEM1 is MEDIUM"

I'm not about to start trying to match strings in the item name to the option name as that's a terribly inefficient and problematic solution.

Am I overlooking something here? Help would be massively appreciated before I sit weeping in a corner somewhere!

Thanks

10 |2000 characters needed characters left characters exceeded

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

1 Answer

Jacob Abrams avatar image
Jacob Abrams answered ·

You can search for all items that are associated with a given option: GET /v3/merchants/{mId}/items?filter=option.id={optionId}

On the other hand, given an arbitrary item to figure out what are its options are is more difficult. It seems like we are missing that functionality. Ideally you should be able to expand that information. I will file a ticket for that.

For now I guess you would have to query all the possible options that an item might be associated with to see which ones it really is associated with. You can add the item id to the query parameters of you don't want to get all the items for an option in case it is very large:

GET /v3/merchants/{mId}/items?filter=option.id={optionId}&id={itemId}

Share
10 |2000 characters needed characters left characters exceeded

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