How to get ItemOption by it's id

I’m using Square REST API to integrate Square into our custom ERP solution.
I’m listening to catalog.version.updated event to list the updated items. Now I want to see what ITEM_OPTION that variant has because I have an id of that itemOption in item i.e.

"itemOptions": [
  {
    "itemOptionId": "6LLNH26WQSUD57WDDJFAVJ34"
  }
]

Now I want to get the itemOption so that I can get its name and its option values but I can’t find any suitable APIs for that! I can search for itemOptions using searchCatalogObjects like the following…

curl https://connect.squareupsandbox.com/v2/catalog/search \
  -X POST \
  -H 'Square-Version: 2023-05-17' \
  -H 'Authorization: Bearer TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "begin_time": "2023-01-31T07:16:11.786Z",
    "include_deleted_objects": true,
    "object_types": [
      "ITEM_OPTION"
    ],
    "query": {
      "exact_query": {
        "attribute_value": "Size",
        "attribute_name": "name" // id argument doesn't work here but name works!
      }
    }
  }'

But for that, I need a name of an option but I can’t seem to find any way in which I can use my id!

NOTE: I’ve already raised this query on slack but though to post here so that it may help someone else in the future!

You can take the ID 6LLNH26WQSUD57WDDJFAVJ34 and call RetrieveCatalogObject to get the ITEM_OPTION instead of calling SearchCatalogObjects. :slightly_smiling_face:

1 Like

Indeed it worked, Don’t know how I missed it but it might because of naming conventions! Since all entities are considered as catalog objects, Now it makes sense why there is only one API for fetching any type of object!